/* ================================================================
   InfoService — Stylesheet Principal · Mobile-First
   ================================================================ */

/* ── 1. CSS VARIABLES ─────────────────────────────────────────── */
:root {
    --primary:       #1a3a5c;
    --primary-dark:  #122840;
    --primary-light: #254f7e;
    --accent:        #e67e22;
    --accent-dark:   #ca6f1e;
    --sidebar-w:     260px;
    --topbar-h:      56px;
    --text-muted:    #6c757d;
    --border:        #dee2e6;
    --bg-light:      #f4f6f9;

    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,.07);
    --shadow-md: 0 4px 12px rgba(0,0,0,.10);
    --shadow-lg: 0 8px 28px rgba(0,0,0,.14);
}

/* ── 2. RESET & BASE ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-light);
    color: #1e293b;
    margin: 0;
    overflow-x: hidden;
    line-height: 1.55;
    font-size: 14px;
}

a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent-dark); }
img { max-width: 100%; height: auto; }

/* ── 3. AUTH PAGES ────────────────────────────────────────────── */
.auth-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, #2980b9 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.auth-card {
    background: #fff;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    padding: clamp(22px, 6vw, 44px) clamp(16px, 6vw, 40px);
}

.auth-logo { text-align: center; margin-bottom: 24px; }

.auth-logo .logo-icon {
    width: 62px; height: 62px;
    background: var(--primary);
    border-radius: var(--r-md);
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 12px;
}
.auth-logo .logo-icon i { font-size: 28px; color: var(--accent); }
.auth-logo h1 { font-size: clamp(20px, 4vw, 26px); font-weight: 700; color: var(--primary); letter-spacing: -.3px; }
.auth-logo p  { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ── 4. APP WRAPPER ───────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── 5. SIDEBAR (mobile-first: ascuns implicit) ───────────────── */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    will-change: transform;
}
.sidebar.open { transform: translateX(0); }

.sidebar-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.sidebar-logo {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none; color: #fff;
    flex: 1; min-width: 0;
}
.sidebar-logo .logo-box {
    width: 36px; height: 36px;
    background: var(--accent);
    border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0;
}
.sidebar-logo .logo-text { font-size: 16px; font-weight: 700; letter-spacing: -.2px; }
.sidebar-logo .logo-sub  { font-size: 11px; opacity: .6; display: block; margin-top: -2px; }

/* Buton X — inchide sidebar pe mobil */
.sidebar-close {
    background: rgba(255,255,255,.12);
    border: none;
    color: rgba(255,255,255,.75);
    width: 32px; height: 32px;
    border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 17px; flex-shrink: 0;
    transition: background .2s, color .2s;
}
.sidebar-close:hover { background: rgba(255,255,255,.2); color: #fff; }

/* Info service */
.sidebar-service-info {
    padding: 10px 14px;
    background: rgba(255,255,255,.07);
    margin: 10px 12px 0;
    border-radius: var(--r-sm);
    font-size: 12px;
}
.sidebar-service-info .svc-name {
    font-weight: 600; font-size: 13px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-service-info .svc-role { opacity: .6; font-size: 11px; margin-top: 2px; }

/* Navigare */
.sidebar-nav { padding: 6px 0; flex: 1; }

.nav-section-title {
    font-size: 10px; text-transform: uppercase;
    letter-spacing: 1px; opacity: .45;
    padding: 14px 20px 5px; font-weight: 600;
}

.sidebar-nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 11px 20px;
    color: rgba(255,255,255,.76);
    font-size: 14px;
    border-left: 3px solid transparent;
    text-decoration: none;
    min-height: 46px;
    transition: background .18s, color .18s;
}
.sidebar-nav a:hover  { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav a.active { background: rgba(255,255,255,.12); color: #fff; border-left-color: var(--accent); font-weight: 500; }
.sidebar-nav a i      { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-nav .badge-nav {
    margin-left: auto;
    background: var(--accent); color: #fff;
    font-size: 11px; padding: 2px 7px;
    border-radius: 20px;
}

/* Footer sidebar */
.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,.1);
    flex-shrink: 0;
}
.sidebar-footer a {
    display: flex; align-items: center; gap: 10px;
    color: rgba(255,255,255,.6); font-size: 13px;
    text-decoration: none; padding: 6px 0;
    min-height: 44px;
    transition: color .2s;
}
.sidebar-footer a:hover { color: #fff; }

/* ── 6. OVERLAY ───────────────────────────────────────────────── */
#sidebarOverlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1040;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
#sidebarOverlay.active { display: block; animation: overlayIn .22s ease; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

/* ── 7. MAIN CONTENT (mobile: full width) ─────────────────────── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    /* margin-left: 0 — default mobil */
}

/* ── 8. TOPBAR ────────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 14px;
    position: sticky; top: 0; z-index: 1000;
    gap: 10px;
}

/* Hamburger — vizibil by default (mobil), ascuns pe desktop via media query */
#sidebarToggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--primary);
    width: 40px; height: 40px;
    border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 20px; flex-shrink: 0;
    padding: 0;
    transition: background .2s, border-color .2s;
}
#sidebarToggle:hover { background: var(--bg-light); border-color: var(--primary); }

.topbar-title {
    flex: 1; min-width: 0;
    font-size: 16px; font-weight: 600;
    color: var(--primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-title small { display: none; } /* ascuns pe mobil */

.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ── 9. PAGE CONTENT ──────────────────────────────────────────── */
.page-content { padding: 14px; flex: 1; }

/* ── 10. CARDS ────────────────────────────────────────────────── */
.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
}
.card-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    border-radius: var(--r-md) var(--r-md) 0 0 !important;
    padding: 12px 16px;
    display: flex; align-items: center;
    justify-content: space-between;
    gap: 10px; flex-wrap: wrap;
}
.card-header h5, .card-header h6 { margin: 0; font-weight: 600; color: var(--primary); }
.card-body { padding: 14px 16px; }

/* ── 11. STAT CARDS ───────────────────────────────────────────── */
.stat-card {
    background: #fff; border-radius: var(--r-md);
    padding: 14px 16px;
    border: 1px solid var(--border);
    display: flex; align-items: center; gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
    width: 46px; height: 46px;
    border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.stat-icon.blue   { background: #e8f0fe; color: #1a56db; }
.stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-icon.orange { background: #fff7ed; color: var(--accent); }
.stat-icon.red    { background: #fee2e2; color: #dc2626; }
.stat-icon.purple { background: #f3e8ff; color: #9333ea; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ── 12. TABELE ───────────────────────────────────────────────── */
.table-card {
    background: #fff; border-radius: var(--r-md);
    border: 1px solid var(--border);
    overflow: hidden; box-shadow: var(--shadow-sm);
}
.table-card > .table-responsive,
.table-card > div > .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-card .table { margin: 0; }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid var(--border);
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px;
    color: var(--text-muted);
    padding: 10px 14px; white-space: nowrap;
}
.table tbody td {
    padding: 10px 14px;
    vertical-align: middle;
    font-size: 13px;
    border-bottom: 1px solid #f0f2f5;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbfc; }

/* ── 13. BUTOANE ──────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: .45rem 1rem;
    border-radius: var(--r-sm);
    font-size: 14px; font-weight: 500;
    cursor: pointer; white-space: nowrap;
    text-decoration: none;
    border: 1px solid transparent;
    min-height: 40px;
    transition: background .18s, border-color .18s, box-shadow .18s, transform .1s;
}
.btn:active { transform: scale(.97); }

.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }

.btn-sm { min-height: 36px; padding: .3rem .75rem; font-size: 12px; }

/* Touch targets pe mobil */
@media (max-width: 767px) {
    .btn     { min-height: 44px; }
    .btn-sm  { min-height: 40px; font-size: 13px; }
}

/* ── 14. FORMS ────────────────────────────────────────────────── */
.form-label { font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 5px; display: block; }

.form-control, .form-select {
    font-size: 16px; /* 16px = previne auto-zoom iOS Safari */
    border-radius: var(--r-sm);
    border: 1px solid #d1d5db;
    padding: .6rem .75rem;
    min-height: 44px; width: 100%;
    transition: border-color .2s, box-shadow .2s;
    background: #fff;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,58,92,.1);
    outline: none;
}

/* Search bars — nu ies din ecran */
form.d-flex { flex-wrap: wrap; gap: 8px; }
form.d-flex .form-control,
form.d-flex .form-select { min-width: 0; flex: 1 1 150px; }

/* ── 15. DEVIZ ────────────────────────────────────────────────── */
.section-title {
    font-size: 13px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px;
    color: var(--primary);
    padding: 10px 0 6px;
    border-bottom: 2px solid var(--primary);
    margin-bottom: 16px;
}

/* Bara identitate deviz — stack pe mobil */
.deviz-identity-bar {
    display: flex; flex-direction: column; gap: 10px;
}

.deviz-table thead th { background: var(--primary); color: #fff; font-size: 12px; padding: 8px 10px; border: none; }
.deviz-table td       { padding: 5px 6px; vertical-align: middle; }
.deviz-table td input,
.deviz-table td select { font-size: 14px; padding: 5px 8px; border-radius: var(--r-sm); min-height: 38px; }
.deviz-table .val-cell { text-align: right; font-weight: 600; color: var(--primary); white-space: nowrap; min-width: 80px; }

.deviz-totals { background: #f8fafc; border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px 20px; }
.deviz-totals .total-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 5px 0; font-size: 14px; border-bottom: 1px solid #eee;
}
.deviz-totals .total-row:last-child { border-bottom: none; }
.deviz-totals .total-final { font-size: 17px; font-weight: 700; color: var(--primary); padding-top: 10px; margin-top: 4px; border-top: 2px solid var(--primary) !important; }

.btn-add-row {
    font-size: 12px; padding: 5px 12px;
    color: var(--primary); border: 1px dashed var(--primary);
    background: transparent; border-radius: var(--r-sm);
    cursor: pointer; min-height: 36px; display: inline-flex; align-items: center; gap: 4px;
    transition: all .2s;
}
.btn-add-row:hover { background: var(--primary); color: #fff; border-style: solid; }

.btn-remove-row {
    background: none; border: none; color: #dc2626;
    cursor: pointer; font-size: 16px; padding: 4px 6px;
    border-radius: 4px; min-height: 36px; min-width: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.btn-remove-row:hover { background: #fee2e2; }

/* ── 16. BADGES ───────────────────────────────────────────────── */
.badge { font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 20px; }

/* ── 17. MISC ─────────────────────────────────────────────────── */
.page-content > .d-flex.mb-4 { flex-wrap: wrap; gap: 8px; }

/* ================================================================
   RESPONSIVE — MOBILE FIRST
   ================================================================ */

/* ── 480px — telefon mai mare ────────────────────────────────── */
@media (min-width: 480px) {
    .page-content { padding: 18px; }
    .stat-value   { font-size: 24px; }
    .topbar       { padding: 0 18px; }
}

/* ── 768px — tableta ──────────────────────────────────────────── */
@media (min-width: 768px) {
    .page-content        { padding: 22px; }
    .topbar              { padding: 0 22px; gap: 14px; }
    .topbar-title        { font-size: 17px; }
    .topbar-title small  { display: inline; }  /* subtitlu vizibil pe tableta */

    .card-header         { padding: 14px 20px; }
    .card-body           { padding: 16px 20px; }

    .form-control,
    .form-select         { font-size: 14px; min-height: 40px; }

    .deviz-identity-bar {
        flex-direction: row;
        align-items: flex-end;
        flex-wrap: wrap;
        gap: 16px;
    }
    .deviz-identity-bar > div { flex: 1 1 150px; }

    .stat-value          { font-size: 26px; }
    .stat-card           { padding: 18px 20px; }
}

/* ── 1025px — desktop: sidebar permanent vizibil ─────────────── */
@media (min-width: 1025px) {
    /* Sidebar permanent */
    .sidebar             { transform: translateX(0); }
    .sidebar-close       { display: none; }

    /* Main content — offset sidebar */
    .main-content        { margin-left: var(--sidebar-w); }

    /* Ascunde hamburger */
    #sidebarToggle       { display: none !important; }

    .topbar              { padding: 0 28px; }
    .page-content        { padding: 28px; }

    .deviz-identity-bar > div { flex: 1 1 180px; }
}

/* ── 1280px — desktop mare ────────────────────────────────────── */
@media (min-width: 1280px) {
    .page-content { padding: 32px; }
    .stat-value   { font-size: 28px; }
}
