/* =====================================================================
   PROSFORAMA — Application stylesheet
   Καθαρό CSS, χωρίς εξαρτήσεις. Mobile-first για μικρές οθόνες.
===================================================================== */

/* ---------- Reset / Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

:root {
    --bg:           #f4f6f9;
    --surface:      #ffffff;
    --surface-2:    #fafbfc;
    --border:       #e2e6ed;
    --text:         #1f2937;
    --text-muted:   #6b7280;
    --primary:      #1f6feb;
    --primary-dk:   #1758c4;
    --success:      #16a34a;
    --warning:      #d97706;
    --danger:       #dc2626;
    --info:         #0284c7;
    --shadow:       0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-lg:    0 8px 28px rgba(15, 23, 42, 0.12);
    --radius:       8px;
    --radius-sm:    4px;
    --sidebar-w:    240px;

    /* Inox-themed accent palette */
    --steel:        #475569;
    --steel-dk:     #334155;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5em 0; color: var(--text); font-weight: 600; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

p { margin: 0 0 1em 0; }
.muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-mono { font-family: ui-monospace, "SF Mono", Consolas, "Courier New", monospace; }

/* ---------- Layout shell ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    background: var(--steel-dk);
    color: #f1f5f9;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand a {
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.02em;
}
.sidebar-brand a:hover { text-decoration: none; }

.sidebar-section {
    padding: 1rem 1rem .25rem 1rem;
    text-transform: uppercase;
    font-size: .7rem;
    letter-spacing: .12em;
    color: rgba(255,255,255,0.5);
}

.sidebar-nav ul {
    list-style: none;
    margin: 0;
    padding: .5rem 0;
}
.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .65rem 1rem;
    color: rgba(255,255,255,0.85);
    font-weight: 500;
    border-left: 3px solid transparent;
}
.sidebar-nav li a:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
    text-decoration: none;
}
.sidebar-nav li.active a {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border-left-color: var(--primary);
}
.nav-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: .85;
}
.nav-icon svg { width: 100%; height: 100%; display: block; }
.sidebar-nav li.active .nav-icon,
.sidebar-nav li a:hover .nav-icon { opacity: 1; }

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: .75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar-title { font-size: 1.05rem; font-weight: 600; color: var(--text); }
.topbar-user  { display: flex; align-items: center; gap: .75rem; }
.user-name    { font-weight: 600; }
.inline-form  { margin: 0; }

.content {
    padding: 1.5rem;
    flex: 1;
    min-width: 0;
}

.page-footer {
    padding: 1rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: .85rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

/* ---------- Login screen ---------- */
.login-body {
    background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;  /* banner at top, card centered in remaining space */
    margin: 0;
}
.login-card {
    background: #fff;
    width: 100%;
    max-width: 420px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    margin: auto;  /* centers vertically + horizontally in remaining flex space */
}
.login-card-wide { max-width: 560px; }
.login-brand { text-align: center; margin-bottom: 1.5rem; }
.login-brand h1 { margin-bottom: .25rem; font-size: 1.6rem; color: var(--steel-dk); }
.login-footer { margin-top: 1.5rem; text-align: center; font-size: .85rem; }
.install-info { background: var(--surface-2); padding: .75rem 1rem; border-radius: var(--radius-sm); }
.install-info code { background: #fff; padding: 0 4px; border-radius: 3px; border: 1px solid var(--border); }
.install-success ol { margin: 0; padding-left: 1.2rem; }

/* ---------- Forms ---------- */
form label {
    display: block;
    margin-top: .85rem;
    margin-bottom: .25rem;
    font-weight: 600;
    font-size: .9rem;
    color: var(--text);
}
form label .required { color: var(--danger); }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=tel], input[type=search], select, textarea {
    width: 100%;
    padding: .55rem .7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31,111,235,0.15);
}
textarea { resize: vertical; min-height: 80px; }
input[readonly], input:disabled, textarea:disabled, select:disabled {
    background: #f3f4f6;
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-4 { grid-template-columns: repeat(4, 1fr); }

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: .5rem;
    align-items: center;
}
.form-help {
    color: var(--text-muted);
    font-size: .8rem;
    margin-top: .25rem;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
    line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn-primary  { background: var(--primary);    color: #fff; border-color: var(--primary); }
.btn-primary:hover  { background: var(--primary-dk); border-color: var(--primary-dk); }
.btn-success  { background: var(--success);    color: #fff; border-color: var(--success); }
.btn-danger   { background: var(--danger);     color: #fff; border-color: var(--danger); }
.btn-warning  { background: var(--warning);    color: #fff; border-color: var(--warning); }
.btn-secondary{ background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: rgba(0,0,0,0.05); color: var(--text); }
.btn-sm { padding: .3rem .65rem; font-size: 12.5px; }
.btn-lg { padding: .75rem 1.4rem; font-size: 16px; }
.btn-block { display: flex; width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* Icon-only buttons (για actions στις λίστες) */
.btn-icon {
    padding: .35rem .45rem;
    line-height: 0;
    border-radius: var(--radius-sm);
}
.btn-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}
.btn-icon-edit {
    background: #fff;
    color: var(--steel-dk);
    border-color: var(--border);
}
.btn-icon-edit:hover {
    background: #eff6ff;
    color: var(--primary-dk);
    border-color: #bfdbfe;
}
.btn-icon-view {
    background: #fff;
    color: var(--steel-dk);
    border-color: var(--border);
}
.btn-icon-view:hover {
    background: var(--surface-2);
    color: var(--primary-dk);
}
.btn-icon-delete {
    background: #fff;
    color: var(--danger);
    border-color: #fecaca;
}
.btn-icon-delete:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

/* Row actions container — keeps icons close together */
.row-actions {
    display: inline-flex;
    gap: .3rem;
    justify-content: flex-end;
    align-items: center;
}
.row-actions form { margin: 0; }

/* Button with leading icon (e.g. + Νέος) */
.btn svg.btn-leading {
    width: 14px;
    height: 14px;
    margin-right: .15rem;
}

/* ---------- Cards / panels ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}
.card-header {
    padding: .9rem 1.2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.card-header h2, .card-header h3 { margin: 0; }
.card-body { padding: 1.2rem; }
.card-footer {
    padding: .75rem 1.2rem;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 0 0 var(--radius) var(--radius);
}

/* ---------- Tables ---------- */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    box-shadow: var(--shadow);
}
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
table.data thead th {
    background: var(--surface-2);
    text-align: left;
    padding: .65rem .75rem;
    font-weight: 600;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table.data tbody td {
    padding: .55rem .75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .actions { white-space: nowrap; text-align: right; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Flash messages ---------- */
.flash {
    padding: .7rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    border: 1px solid;
    font-size: 14px;
}
.flash-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.flash-error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.flash-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    line-height: 1.4;
    white-space: nowrap;
}
.badge-admin     { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.badge-estimator { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.badge-viewer    { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; }

.badge-draft    { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; }
.badge-sent     { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.badge-accepted { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.badge-rejected { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

/* ---------- Page header ---------- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
    gap: 1rem;
}
.page-header h1 { margin: 0; }
.page-header .actions { display: flex; gap: .5rem; }

/* ---------- Toolbar / filters ---------- */
.toolbar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .75rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
}
.toolbar input, .toolbar select { width: auto; min-width: 180px; }

/* ---------- KPI tiles (dashboard) ---------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    box-shadow: var(--shadow);
}
.kpi-label { font-size: .85rem; color: var(--text-muted); margin-bottom: .35rem; }
.kpi-value { font-size: 1.6rem; font-weight: 700; color: var(--text); }
.kpi-sub   { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }

/* ---------- Quote editor ---------- */
.quote-line {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.2rem;
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.quote-line-header {
    background: linear-gradient(135deg, #1f2937 0%, #334155 100%);
    color: #fff;
    padding: .7rem 1rem;
    display: flex;
    align-items: center;
    gap: .55rem;
}
.quote-line-header .line-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    opacity: .9;
}
.quote-line-header .line-icon svg { width: 100%; height: 100%; display: block; }
.quote-line-header .line-number {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: .01em;
}
.quote-line-header .line-remove-btn {
    margin-left: auto;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.18);
    color: #fecaca;
    padding: .3rem .45rem;
    border-radius: 4px;
    cursor: pointer;
    line-height: 0;
    transition: background .15s, border-color .15s, color .15s;
}
.quote-line-header .line-remove-btn svg { width: 14px; height: 14px; display: block; }
.quote-line-header .line-remove-btn:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.quote-line-body { padding: 1.2rem; }

/* Colored sections inside a construction line */
.line-section {
    margin-top: 1.1rem;
    padding: .9rem 1.1rem 1rem 1.1rem;
    border-radius: 6px;
    border-left: 3px solid var(--border);
    background: var(--surface-2);
}
.line-section:first-of-type { margin-top: 1rem; }
.line-section h4 {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0 0 .75rem 0;
    border: 0;
    padding: 0;
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .01em;
}
.line-section .section-icon {
    display: inline-flex;
    width: 17px;
    height: 17px;
}
.line-section .section-icon svg { width: 100%; height: 100%; display: block; }

/* Color variants per section */
.line-section-dim         { border-left-color: #94a3b8; background: rgba(148, 163, 184, 0.07); }
.line-section-dim h4      { color: #475569; }
.line-section-material    { border-left-color: #3b82f6; background: rgba(59, 130, 246, 0.06); }
.line-section-material h4 { color: #1e40af; }
.line-section-operations  { border-left-color: #f59e0b; background: rgba(245, 158, 11, 0.07); }
.line-section-operations h4 { color: #b45309; }
.line-section-machines    { border-left-color: #8b5cf6; background: rgba(139, 92, 246, 0.07); }
.line-section-machines h4 { color: #6d28d9; }
.line-section-products    { border-left-color: #10b981; background: rgba(16, 185, 129, 0.06); }
.line-section-products h4 { color: #047857; }
.line-section-pricing     { border-left-color: #e11d48; background: rgba(225, 29, 72, 0.05); }
.line-section-pricing h4  { color: #be123c; }

/* Tables inside sections — transparent so the section tint shows */
.line-section table.sublines { background: transparent; margin-bottom: .5rem; }
.line-section table.sublines thead th {
    background: rgba(255,255,255,0.6);
    color: var(--text);
    font-weight: 600;
}
.line-section table.sublines tbody tr { background: rgba(255,255,255,0.4); }
.line-section table.sublines tbody tr:hover { background: rgba(255,255,255,0.7); }

table.sublines th, table.sublines td { padding: .35rem .5rem; }
table.sublines input, table.sublines select {
    padding: .3rem .5rem;
    font-size: 13px;
}
table.sublines .actions { width: 40px; }
.btn-remove-row {
    padding: .15rem .5rem;
    line-height: 1;
}

/* Add-row buttons inside sections */
.btn-section-add {
    background: #fff;
    border-color: var(--border);
    color: var(--text);
    margin-top: .3rem;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}
.btn-section-add svg {
    width: 12px;
    height: 12px;
}
.btn-section-add:hover {
    background: var(--surface-2);
    border-color: var(--text-muted);
}

/* Area display — readonly auto-computed field */
.line-section input.area-display {
    background: rgba(255,255,255,0.55);
    font-weight: 600;
    color: var(--steel-dk);
}

/* ---------- Live calc indicator (στο header του Σύνολα) ---------- */
.calc-indicator {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .8rem;
    font-weight: 600;
    padding: .2rem .65rem;
    border-radius: 999px;
    transition: opacity .2s, background .2s, color .2s;
}
.calc-indicator::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}
.calc-indicator.is-loading {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}
.calc-indicator.is-loading::before {
    animation: pulse-dot 1s ease-in-out infinite;
}
.calc-indicator.is-ok {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.calc-indicator.is-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .35; transform: scale(0.7); }
}

/* ---------- Line summary footer ---------- */
.line-summary {
    margin-top: 1.2rem;
    background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
    color: #fff;
    padding: 1rem 1.25rem;
    border-radius: 6px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}
.line-summary > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.line-summary > div span {
    color: rgba(255,255,255,0.65);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    font-weight: 500;
}
.line-summary > div strong {
    font-size: 1.15rem;
    color: #fff;
    font-variant-numeric: tabular-nums;
}
.line-summary > div.profit strong { color: #6ee7b7; }

/* ---------- Bar chart (Dashboard) ---------- */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: .4rem;
    height: 200px;
    padding: .5rem 0;
}
.bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    min-width: 0;
}
.bar-value {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    min-height: 1em;
}
.bar {
    width: 70%;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dk) 100%);
    border-radius: 4px 4px 0 0;
    min-height: 2px;
    transition: opacity .15s;
}
.bar-wrap:hover .bar { opacity: .85; }
.bar-label {
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: center;
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 1rem 0;
    justify-content: flex-end;
}

/* ---------- Mobile responsive ---------- */
@media (max-width: 900px) {
    :root { --sidebar-w: 60px; }
    .nav-label, .sidebar-brand a, .sidebar-section { display: none; }
    .sidebar-nav li a { justify-content: center; padding: .75rem 0; }
    .nav-icon { width: auto; font-size: 1.1rem; }
    .content { padding: 1rem; }
    .form-row.cols-2, .form-row.cols-3, .form-row.cols-4 { grid-template-columns: 1fr; }
}

/* =====================================================================
   Trial-mode banner (layouts/_trial_banner.php)
   Persistent header strip marking demo installs + sales contact.
===================================================================== */
.trial-banner {
    background: linear-gradient(90deg, #b45309 0%, #d97706 50%, #f59e0b 100%);
    color: #fff;
    padding: 8px 16px;
    text-align: center;
    font-size: .9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    box-shadow: 0 2px 4px rgba(0,0,0,.12);
    position: relative;
    z-index: 100;
    line-height: 1.4;
}
.trial-banner .trial-pill {
    background: rgba(0,0,0,.32);
    padding: 3px 11px;
    border-radius: 99px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    white-space: nowrap;
    text-transform: uppercase;
}
.trial-banner .trial-msg {
    color: #fff;
    font-weight: 500;
}
.trial-banner .trial-phone {
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    background: rgba(0,0,0,.32);
    padding: 4px 14px;
    border-radius: 5px;
    font-size: 1rem;
    transition: background .15s, transform .15s;
    white-space: nowrap;
    letter-spacing: .02em;
}
.trial-banner .trial-phone:hover {
    background: rgba(0,0,0,.5);
    transform: translateY(-1px);
}
.trial-banner .trial-phone:active {
    transform: translateY(0);
}

@media (max-width: 600px) {
    .trial-banner { font-size: .8rem; padding: 6px 12px; gap: 8px; }
    .trial-banner .trial-msg { display: none; } /* keep pill + phone on small screens */
    .trial-banner .trial-phone { font-size: .92rem; padding: 3px 10px; }
}

@media print {
    .trial-banner { display: none !important; }
}
