/* ============================================
   MegaPost Consultation - Professional Design
   Modern, clean, flat colors - No gradients
   ============================================ */

:root {
    /* Couleurs principales */
    --primary: #2563EB;
    --primary-hover: #1D4ED8;
    --accent: #0F766E;
    --success: #16A34A;
    --warning: #D97706;
    --danger: #DC2626;

    /* Surfaces */
    --bg-light: #F4F6F9;
    --bg-white: #FFFFFF;
    --sidebar: #0F172A;
    --sidebar-hover: #1E293B;

    /* Texte */
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-muted: #94A3B8;
    --text-white: #FFFFFF;
    --text-sidebar: #E5E7EB;
    --text-sidebar-muted: #94A3B8;

    /* Bordures et ombres */
    --border: #E5E7EB;
    --border-input: #D1D5DB;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 20px rgba(15, 23, 42, 0.06);
}

/* ============================================
   GLOBAL STYLES
   ============================================ */

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ============================================
   AUTH PAGES (Login, Reset Password, etc.)
   ============================================ */

.auth-body {
    min-height: 100vh;
    background: #0F172A;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: var(--text-white);
}

.auth-wrapper {
    width: min(1180px, 100%);
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 28px;
}

.auth-hero {
    border: 1px solid #334155;
    border-radius: 32px;
    background: #111827;
    padding: 56px;
    align-items: flex-end;
    min-height: 640px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.auth-hero h1 {
    font-size: 56px;
    line-height: 1.02;
    font-weight: 900;
    letter-spacing: -0.04em;
    margin: 20px 0;
    color: #F8FAFC;
}

.auth-hero p {
    font-size: 18px;
    color: #CBD5E1;
    max-width: 620px;
}

.hero-pill {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    padding: 9px 14px;
    border-radius: 99px;
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.3);
    color: #38BDF8;
    font-size: 13px;
    font-weight: 600;
}

.auth-card,
.auth-small-card {
    background: #FFFFFF;
    color: var(--text-primary);
    border-radius: 28px;
    padding: 38px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
    align-self: center;
    border: 1px solid #E5E7EB;
}

.auth-small-card {
    width: min(480px, 100%);
}

.auth-card h2,
.auth-small-card h2 {
    font-weight: 900;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.auth-card p,
.auth-small-card p {
    color: var(--text-secondary);
}

.auth-card a,
.auth-small-card a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.auth-card a:hover,
.auth-small-card a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.auth-brand {
    margin-bottom: 26px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 900;
    font-size: 22px;
    text-decoration: none;
    color: inherit;
}

.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--primary);
    color: var(--text-white);
    box-shadow: var(--shadow-md);
}

.btn-primary-gradient,
.btn-primary {
    border: 0;
    color: var(--text-white) !important;
    background: var(--primary);
    font-weight: 700;
    transition: all 0.3s ease;
}

.btn-primary-gradient:hover,
.btn-primary:hover {
    background: var(--primary-hover);
}

/* ============================================
   APPLICATION SHELL (Sidebar + Main)
   ============================================ */

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
    transition: grid-template-columns 0.3s ease;
}

.app-shell.sidebar-collapsed {
    grid-template-columns: 70px 1fr;
}

.btn-toggle-sidebar {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 18px;
    padding: 6px 12px;
    transition: all 0.3s ease;
    display: none;
}

.app-shell.sidebar-collapsed .btn-toggle-sidebar {
    transform: scaleX(-1);
}

.sidebar {
    background: var(--sidebar);
    color: var(--text-sidebar);
    padding: 24px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.3s ease;
}

.app-shell.sidebar-collapsed .sidebar {
    padding: 12px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sidebar .brand {
    margin-bottom: 20px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-sidebar);
}

.sidebar .brand-logo {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: var(--text-white);
}

.sidebar .brand-logo-img {
    width: 40px;
    height: 40px;
}

.app-shell.sidebar-collapsed .sidebar .brand {
    margin-bottom: 16px;
}

.app-shell.sidebar-collapsed .sidebar .brand span {
    display: none !important;
}

.app-shell.sidebar-collapsed .nav-menu {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.app-shell.sidebar-collapsed .nav-menu a {
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    position: relative;
}

.app-shell.sidebar-collapsed .nav-menu a span {
    display: none !important;
}

.app-shell.sidebar-collapsed .nav-menu a i {
    font-size: 20px;
    margin: 0;
}

.sidebar .user-box {
    margin-top: auto;
}

.app-shell.sidebar-collapsed .sidebar .user-box {
    display: none !important;
}

.user-box {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 18px;
    margin: 24px 0;
    border: 1px solid rgba(229, 231, 235, 0.3);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.08);
}

.user-box small {
    display: block;
    color: var(--text-sidebar-muted);
    font-size: 12px;
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 15px;
    background: var(--primary);
    display: grid;
    place-items: center;
    font-weight: 900;
    color: var(--text-white);
    flex-shrink: 0;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
}

.nav-menu a,
.nav-link {
    color: var(--text-sidebar-muted);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
    transition: all 0.3s ease;
}

.nav-menu a:hover,
.nav-menu a.active,
.nav-link:hover {
    background: var(--sidebar-hover);
    color: var(--text-white);
    border-left: 3px solid var(--primary);
    padding-left: 9px;
}

.nav-menu a.active {
    background: var(--sidebar-hover);
    color: var(--text-white);
    border-left: 3px solid var(--primary);
    padding-left: 9px;
}

.logout-link {
    margin-top: 18px;
    color: #FCA5A5 !important;
}

.logout-link:hover {
    background: rgba(220, 38, 38, 0.1) !important;
    color: var(--text-white) !important;
}

.content {
    padding: 30px;
    background: var(--bg-light);
}

/* ============================================
   TOPBAR
   ============================================ */

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    margin-bottom: 24px;
}

.topbar h1 {
    font-weight: 900;
    margin: 0;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.topbar p {
    margin: 4px 0 0 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.topbar-badge {
    padding: 10px 14px;
    border-radius: 99px;
    background: #DBEAFE;
    color: #1E40AF;
    border: 1px solid #BFDBFE;
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
}

.topbar-user {
    display: flex;
    align-items: center;
}

.btn-user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-user-profile:hover {
    background-color: #F3F4F6;
    border-color: #D1D5DB;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: var(--primary);
    color: var(--text-white);
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 14px;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.user-name {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary);
    display: block;
}

.user-role {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
}

.dropdown-menu {
    min-width: 240px;
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.dropdown-item {
    padding: 10px 16px;
    border-radius: 8px;
    margin: 0 6px;
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background-color: #F3F4F6;
    color: var(--primary);
}

.dropdown-item.text-danger:hover {
    background-color: #FEE2E2;
    color: #7F1D1D;
}

.brand-logo-img {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    object-fit: contain;
    background: var(--primary);
    padding: 4px;
}

/* ============================================
   CARDS & PANELS
   ============================================ */

.panel,
.filter-card,
.stat-card,
.mini-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 22px;
    box-shadow: var(--shadow-lg);
}

.filter-card {
    border-left: 5px solid var(--primary);
}

.stat-card {
    position: relative;
    overflow: hidden;
    min-height: 142px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-card span {
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card strong {
    display: block;
    font-size: 30px;
    margin-top: 12px;
    font-weight: 900;
    color: var(--text-primary);
}

.stat-card i {
    position: absolute;
    right: 20px;
    bottom: 18px;
    font-size: 52px;
    color: rgba(37, 99, 235, 0.1);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.stat-icon.primary {
    background: #DBEAFE;
    color: var(--primary);
}

.stat-icon.success {
    background: #DCFCE7;
    color: var(--success);
}

.stat-icon.warning {
    background: #FEF3C7;
    color: var(--warning);
}

.stat-icon.danger {
    background: #FEE2E2;
    color: var(--danger);
}

.mini-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
}

.mini-card b {
    color: var(--text-secondary);
    font-weight: 600;
}

.mini-card strong {
    font-size: 34px;
    color: var(--primary);
    font-weight: 900;
}

.panel h5 {
    font-weight: 900;
    margin-bottom: 18px;
    color: var(--text-primary);
    font-size: 16px;
}

/* ============================================
   TABLES
   ============================================ */

.table {
    margin-bottom: 0;
}

.table thead {
    background: #F9FAFB;
}

.table thead th {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    font-weight: 700;
    border-color: var(--border);
}

.table td,
.table th {
    vertical-align: middle;
    border-color: var(--border);
}

.table tbody tr:hover {
    background-color: #F3F4F6;
}

.table tbody tr:last-child td {
    border-bottom-color: var(--border);
}

/* ============================================
   FORMS
   ============================================ */

.form-control,
.form-select {
    border-radius: 12px;
    border: 1px solid var(--border-input);
    padding: 11px 14px;
    transition: all 0.3s ease;
    background: var(--bg-white);
    color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    outline: none;
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

/* Auth page specific form styles */
.auth-card .form-control,
.auth-small-card .form-control,
.auth-card .form-select,
.auth-small-card .form-select {
    border: 1px solid #E5E7EB;
    padding: 12px 14px;
    font-size: 16px;
}

.auth-card .form-control::placeholder,
.auth-small-card .form-control::placeholder {
    color: #9CA3AF;
}

.auth-card .form-control:focus,
.auth-small-card .form-control:focus,
.auth-card .form-select:focus,
.auth-small-card .form-select:focus {
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
    outline: none;
}

.auth-card .form-label,
.auth-small-card .form-label {
    color: #111827;
    font-weight: 600;
    font-size: 14px;
}

.auth-card .input-group,
.auth-small-card .input-group {
    gap: 0;
}

/* ============================================
   BADGES & ALERTS
   ============================================ */

.badge {
    border-radius: 99px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 600;
}

.badge.text-bg-primary {
    background: #DBEAFE !important;
    color: #1E40AF !important;
}

.badge.text-bg-success {
    background: #DCFCE7 !important;
    color: #166534 !important;
}

.badge.text-bg-warning {
    background: #FEF3C7 !important;
    color: #92400E !important;
}

.badge.text-bg-danger {
    background: #FEE2E2 !important;
    color: #7F1D1D !important;
}

.badge.text-bg-dark {
    background: #F3F4F6 !important;
    color: #111827 !important;
}

.alert {
    border-radius: 16px;
    border: 1px solid;
    padding: 14px 16px;
    margin-bottom: 20px;
}

.alert-info {
    background-color: #DBEAFE;
    border-color: #BFDBFE;
    color: #1E40AF;
}

.alert-warning {
    background-color: #FEF3C7;
    border-color: #FCD34D;
    color: #92400E;
}

.alert-danger {
    background-color: #FEE2E2;
    border-color: #FECACA;
    color: #7F1D1D;
}

.alert-success {
    background-color: #DCFCE7;
    border-color: #BBFDDA;
    color: #166534;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    transition: all 0.3s ease;
    border-radius: 12px;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-white);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: var(--text-white);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: var(--text-white);
}

.btn-success:hover {
    background: #15803D;
    border-color: #15803D;
    color: var(--text-white);
}

.btn-warning {
    background: var(--warning);
    border-color: var(--warning);
    color: var(--text-white);
}

.btn-warning:hover {
    background: #B45309;
    border-color: #B45309;
    color: var(--text-white);
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: var(--text-white);
}

.btn-danger:hover {
    background: #B91C1C;
    border-color: #B91C1C;
    color: var(--text-white);
}

.btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary);
    background: transparent;
}

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

.btn-outline-secondary {
    border-color: var(--border);
    color: var(--text-primary);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: #F3F4F6;
    border-color: #D1D5DB;
    color: var(--text-primary);
}

.btn-outline-danger {
    border-color: var(--danger);
    color: var(--danger);
    background: transparent;
}

.btn-outline-danger:hover {
    background: #FEE2E2;
    border-color: var(--danger);
    color: var(--danger);
}

.btn-outline-warning {
    border-color: var(--warning);
    color: var(--warning);
    background: transparent;
}

.btn-outline-warning:hover {
    background: #FEF3C7;
    border-color: var(--warning);
    color: var(--warning);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 991px) {
    .auth-wrapper {
        grid-template-columns: 1fr;
    }

    .auth-hero {
        display: none;
    }

    .auth-body {
        padding: 20px;
    }

    .auth-card,
    .auth-small-card {
        width: 100%;
        max-width: 480px;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        height: auto;
        position: relative;
        margin-bottom: 20px;
    }

    .content {
        padding: 18px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .auth-hero h1 {
        font-size: 38px;
    }

    .stat-card strong {
        font-size: 24px;
    }

    .table {
        font-size: 13px;
    }

    .table th,
    .table td {
        padding: 0.5rem;
    }
}

@media (max-width: 768px) {
    .auth-body {
        padding: 16px;
    }

    .auth-card,
    .auth-small-card {
        padding: 28px;
        border-radius: 20px;
    }

    .nav-menu {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }

    .nav-menu a {
        padding: 8px 10px;
        font-size: 13px;
        flex: 1 1 45%;
    }

    .row {
        gap: 12px !important;
    }

    .row > * {
        min-width: 0;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-muted {
    color: var(--text-muted) !important;
}

.text-danger {
    color: var(--danger);
}

.text-primary {
    color: var(--primary);
}

.text-success {
    color: var(--success);
}

code {
    background-color: #F3F4F6;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 13px;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
}

hr {
    border-color: var(--border);
}

.d-inline {
    display: inline;
}

/* ============================================
   ANIMATIONS & TRANSITIONS
   ============================================ */

.btn,
.form-control,
.form-select,
.nav-menu a {
    transition: all 0.3s ease;
}

button:active,
.btn:active {
    transform: scale(0.98);
}

/* ============================================
   PASSWORD TOGGLE
   ============================================ */

.input-group .toggle-password-btn {
    border-left: none;
    padding: 0.5rem 0.75rem;
    border: 1px solid #E5E7EB;
    background: #FFFFFF;
    color: #6B7280;
    transition: all 0.3s ease;
}

.input-group .toggle-password-btn:hover {
    background-color: #F9FAFB;
    color: var(--text-primary);
    border-color: #D1D5DB;
}

.input-group .toggle-password-btn i {
    font-size: 18px;
}

/* Auth page specific button and HR styles */
.auth-card hr,
.auth-small-card hr {
    border-color: #E5E7EB;
    opacity: 1;
    margin: 1.5rem 0;
}

.auth-card .small,
.auth-small-card .small {
    color: #6B7280;
}

/* ============================================
   MODAL STYLES
   ============================================ */

.modal-content {
    border: 1px solid var(--border);
    background: var(--bg-white);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    background: #F9FAFB;
}

.modal-footer {
    border-top: 1px solid var(--border);
    background: #F9FAFB;
}

.btn-close {
    filter: invert(0);
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .sidebar,
    .topbar,
    .logout-link,
    .btn {
        display: none;
    }

    body {
        background: var(--bg-white);
        color: var(--text-primary);
    }

    .content {
        padding: 0;
    }
}
