/* ============================================================
   FacturaInCloud - CSS Global
   /css/style.css

   Pentru a schimba tema intregii aplicatii,
   modifica doar variabilele din :root
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ============================================================
   VARIABILE TEMA - MODIFICA AICI
   ============================================================ */
:root {
    /* Culoare principala */
    --primary:          #6d28d9;
    --primary-dk:       #4c1d95;
    --primary-lt:       #ede9fe;
    --primary-mid:      #7c3aed;
    --primary-hover:    #5b21b6;

    /* Accent */
    --accent:           #a78bfa;
    --accent-glow:      rgba(109, 40, 217, 0.25);

    /* Neutrale */
    --text:             #0f0a1e;
    --text-2:           #4b5563;
    --text-3:           #9ca3af;
    --border:           #e5e7eb;
    --border-dk:        #d1d5db;
    --bg:               #f8f7ff;
    --bg-2:             #f3f4f6;
    --white:            #ffffff;

    /* Status */
    --green:            #059669;
    --green-bg:         #ecfdf5;
    --green-border:     #6ee7b7;
    --red:              #dc2626;
    --red-bg:           #fef2f2;
    --red-border:       #fecaca;
    --orange:           #d97706;
    --orange-bg:        #fffbeb;
    --orange-border:    #fde68a;

    /* Layout */
    --sidebar-w:        240px;
    --header-h:         64px;
    --radius:           12px;
    --radius-lg:        16px;
    --radius-xl:        20px;
    --shadow-sm:        0 1px 4px rgba(0,0,0,0.06);
    --shadow:           0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg:        0 8px 40px rgba(0,0,0,0.12);
    --shadow-primary:   0 4px 20px rgba(109,40,217,0.30);

    /* Fonturi */
    --font-display:     'Syne', sans-serif;
    --font-body:        'DM Sans', sans-serif;

    /* Tranzitii */
    --transition:       0.18s ease;
}

/* ============================================================
   RESET + BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { font-size: 15px; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* ============================================================
   LAYOUT DASHBOARD
   ============================================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-logo {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo .logo-mark {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo .logo-icon {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    box-shadow: var(--shadow-primary);
    flex-shrink: 0;
}

.sidebar-logo .logo-text {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 800;
    color: var(--white);
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.sidebar-logo .logo-text span { color: var(--accent); }

.sidebar-user {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-user .user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .user-id {
    font-size: 11px;
    color: rgba(255,255,255,0.35);
    font-family: 'Courier New', monospace;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.nav-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.25);
    padding: 8px 10px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: rgba(255,255,255,0.55);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    cursor: pointer;
    margin-bottom: 2px;
    text-decoration: none;
}

.nav-item:hover {
    background: rgba(255,255,255,0.07);
    color: var(--white);
}

.nav-item.active {
    background: var(--primary);
    color: var(--white);
    box-shadow: var(--shadow-primary);
}

.nav-item .nav-icon {
    width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.nav-item.logout {
    color: rgba(255,255,255,0.4);
}

.nav-item.logout:hover {
    background: rgba(220,38,38,0.15);
    color: #fca5a5;
}

/* ---- MAIN CONTENT ---- */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page-header {
    padding: 32px 36px 0;
}

.page-title {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-3);
}

.page-body {
    padding: 28px 36px 40px;
    flex: 1;
}

/* ============================================================
   CARDURI STATISTICI
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--primary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.green::before  { background: var(--green); }
.stat-card.orange::before { background: var(--orange); }

.stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-3);
    margin-bottom: 10px;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -1px;
    line-height: 1;
    margin-bottom: 6px;
}

.stat-value .currency {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-3);
    margin-left: 3px;
}

.stat-sub {
    font-size: 12px;
    color: var(--text-3);
}

.stat-icon {
    position: absolute;
    top: 18px; right: 18px;
    font-size: 28px;
    opacity: 0.12;
}

/* ============================================================
   TABELE
   ============================================================ */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.card-body { padding: 0; }

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 11px 20px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-3);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--bg-2);
    transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg); }

tbody td {
    padding: 14px 20px;
    font-size: 13.5px;
    color: var(--text);
    vertical-align: middle;
}

/* ============================================================
   BADGES / STATUS
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
}

.badge-green  { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-border); }
.badge-orange { background: var(--orange-bg); color: var(--orange); border: 1px solid var(--orange-border); }
.badge-red    { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-border); }
.badge-purple { background: var(--primary-lt); color: var(--primary); border: 1px solid var(--accent); }

/* ============================================================
   BUTOANE
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
    color: var(--white);
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(109,40,217,0.35);
}

.btn-outline {
    background: var(--white);
    color: var(--text);
    border: 1.5px solid var(--border-dk);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-lt);
}

/* ============================================================
   FORMULARE
   ============================================================ */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font-body);
    color: var(--text);
    background: #fafafa;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(109,40,217,0.12);
    background: var(--white);
}

/* ============================================================
   ALERTE / FLASH MESSAGES
   ============================================================ */
.alert {
    padding: 13px 16px;
    border-radius: var(--radius);
    font-size: 13.5px;
    line-height: 1.5;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success { background: var(--green-bg);  border: 1px solid var(--green-border);  color: var(--green); }
.alert-error   { background: var(--red-bg);    border: 1px solid var(--red-border);    color: var(--red); }
.alert-warning { background: var(--orange-bg); border: 1px solid var(--orange-border); color: var(--orange); }
.alert-info    { background: var(--primary-lt); border: 1px solid var(--accent);       color: var(--primary-dk); }

/* ============================================================
   ANIMATII INTRARE
   ============================================================ */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-up { animation: fadeUp 0.35s ease both; }
.fade-up-1 { animation-delay: 0.05s; }
.fade-up-2 { animation-delay: 0.10s; }
.fade-up-3 { animation-delay: 0.15s; }
.fade-up-4 { animation-delay: 0.20s; }

/* ============================================================
   MOBILE TOPBAR
   ============================================================ */
.mobile-topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 56px;
    background: var(--text);
    position: sticky;
    top: 0;
    z-index: 200;
    flex-shrink: 0;
}

.mobile-logo {
    display: flex; align-items: center; gap: 8px;
    text-decoration: none;
}
.mobile-logo-icon {
    width: 30px; height: 30px;
    background: var(--primary);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
}
.mobile-logo-text {
    font-family: var(--font-display);
    font-size: 15px; font-weight: 800;
    color: var(--white);
}
.mobile-logo-text span { color: var(--accent); }

.hamburger {
    width: 36px; height: 36px;
    background: rgba(255,255,255,0.1);
    border: none; border-radius: 8px;
    cursor: pointer;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 5px; padding: 0;
    transition: background var(--transition);
}
.hamburger:hover { background: rgba(255,255,255,0.18); }
.hamburger span {
    display: block;
    width: 18px; height: 2px;
    background: var(--white);
    border-radius: 2px;
    transition: all 0.25s ease;
    transform-origin: center;
}
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Overlay */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    :root { --sidebar-w: 0px; }

    .mobile-topbar { display: flex; }

    .sidebar {
        transform: translateX(-240px);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 100;
        width: 240px;
        top: 0;
    }
    .sidebar.open { transform: translateX(0); }

    .main-content {
        margin-left: 0;
        flex-direction: column;
    }

    .page-header {
        padding: 20px 16px 0;
    }
    .page-header .page-title { font-size: 20px; }

    .page-body {
        padding: 16px 16px 32px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card { padding: 16px; }
    .stat-value { font-size: 22px; }

    thead th, tbody td { padding: 10px 12px; font-size: 12.5px; }

    .card-header { padding: 14px 16px; flex-wrap: wrap; gap: 8px; }

    /* Firma bar pe mobil */
    .firma-bar {
        padding: 10px 16px;
        flex-wrap: wrap;
        gap: 8px;
        position: static;
    }
    .firma-bar-info .name { font-size: 12px; }
    .firma-switcher select { max-width: 140px; font-size: 11.5px; }

    /* Tabel scroll orizontal */
    .card-body { overflow-x: auto; }
    table { min-width: 480px; }

    /* Profile grid */
    .profile-grid { grid-template-columns: 1fr !important; }

    /* Form rows */
    .form-row-3, .form-row-2 { grid-template-columns: 1fr !important; }

    /* Butoane */
    .btn { font-size: 13px; padding: 9px 14px; }

    /* Page header cu buton dreapta */
    .page-header > div { flex-wrap: wrap; gap: 10px; }
}

@media (max-width: 400px) {
    .stats-grid { grid-template-columns: 1fr; }
}
