/* ==========================================================================
   iTravCo Unified Portal — Main Stylesheet
   Layout, grid system, sidebar, responsive breakpoints
   Design System: iTravCo Brand (Blue Royal + Rose Magenta)
   ========================================================================== */

/* ── Design System: CSS Custom Properties ─────────────────────────────── */
:root {
  /* ── Primaire : Bleu Royal iTravCo ── */
  --color-primary:        #10559A;
  --color-primary-dark:   #0D4580;
  --color-primary-light:  #EBF2F9;
  --color-primary-muted:  #4A7EB2;

  /* ── Accent : Rose/Magenta iTravCo (signature marque) ── */
  --color-accent:         #E54A89;
  --color-accent-light:   #FDF0F5;
  --color-accent-dark:    #C93B73;

  /* ── Sémantique ── */
  --color-success:        #2D8F5C;
  --color-success-light:  #EAF5F0;
  --color-danger:         #D14343;
  --color-danger-light:   #FCEEED;
  --color-warning:        #D4883C;
  --color-warning-light:  #FEF5E8;
  --color-info:           #4A7EB2;
  --color-info-light:     #EBF2F9;

  /* ── Neutres : Fond chaud sable ── */
  --color-bg:             #F7F5F2;
  --color-bg-card:        #FFFFFF;
  --color-bg-hover:       #F2EFE9;
  --color-bg-muted:       #F0EDE8;
  --color-border:         #E4DFD8;
  --color-border-light:   #F0ECE6;
  --color-text:           #2C2825;
  --color-text-secondary: #6B635B;
  --color-text-muted:     #9B9389;

  /* ── Sidebar ── */
  --sidebar-bg:           linear-gradient(180deg, #10559A 0%, #0D4580 60%, #0A3566 100%);
  --sidebar-active-accent:#E54A89;
  --sidebar-width:        260px;

  /* ── Typographie ── */
  --font-display:         'Poppins', sans-serif;
  --font-body:            'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* ── Ombres ── */
  --shadow-sm:   0 2px 6px rgba(44,40,37,0.06);
  --shadow-md:   0 4px 12px rgba(44,40,37,0.08);
  --shadow-lg:   0 8px 24px rgba(44,40,37,0.10);

  /* ── Rayons ── */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
}

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

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

img {
    max-width: 100%;
    height: auto;
}

/* ---------- Animations ---------- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: #fff;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease;
}

.sidebar-header {
    padding: 24px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-header h2 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header h2 img {
    height: 38px;
    width: auto;
    border-radius: 4px;
}

.sidebar-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
    letter-spacing: 0.3px;
}

/* Sidebar stats */
.sidebar-stats {
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-stat {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 13px;
}

.sidebar-stat .label {
    color: rgba(255, 255, 255, 0.55);
}

.sidebar-stat .value {
    font-weight: 600;
    font-family: var(--font-display);
}

/* Sidebar navigation */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.nav-section-title {
    padding: 16px 20px 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.35);
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    text-decoration: none;
    border-left-color: rgba(229, 74, 137, 0.3);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-left-color: var(--sidebar-active-accent);
    font-weight: 600;
}

.nav-item .icon {
    margin-right: 10px;
    font-size: 16px;
    width: 22px;
    text-align: center;
}

.nav-item .nav-badge {
    margin-left: auto;
    background: rgba(229, 74, 137, 0.35);
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
}

/* ---------- Main Content ---------- */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 24px 32px;
    min-height: 100vh;
    transition: margin-left 0.25s ease;
    animation: fadeIn 0.3s ease;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h1 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--color-primary);
}

.page-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.breadcrumb a {
    color: var(--color-text-muted);
}

.breadcrumb a:hover {
    color: var(--color-primary);
}

.breadcrumb .separator {
    color: var(--color-border);
}

/* ---------- Cards ---------- */
.card {
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--color-primary);
}

.card-body {
    font-size: 14px;
}

.card-footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border-light);
}

/* ---------- Grid Utilities ---------- */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

.grid-7 {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 20px;
}

/* ---------- Flexbox Utilities ---------- */
.flex {
    display: flex;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gap-8 {
    gap: 8px;
}

.gap-12 {
    gap: 12px;
}

.gap-16 {
    gap: 16px;
}

.gap-20 {
    gap: 20px;
}

/* ---------- Spacing Utilities ---------- */
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* ---------- Text Utilities ---------- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--color-text-muted); }
.text-small { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-primary { color: var(--color-primary); }
.text-accent { color: var(--color-accent); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

/* ---------- Mobile sidebar toggle ---------- */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    padding: 8px 12px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: background 0.2s ease;
}

.sidebar-toggle:hover {
    background: var(--color-primary-dark);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(16, 85, 154, 0.4);
    z-index: 90;
    backdrop-filter: blur(2px);
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }
    .grid-7 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-5 {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-7 {
        grid-template-columns: repeat(3, 1fr);
    }
    .main-content {
        padding: 20px 20px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: block;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
        padding-top: 56px;
    }

    .grid-2,
    .grid-3,
    .grid-4,
    .grid-5,
    .grid-7 {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-header-actions {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 12px;
        padding-top: 56px;
    }

    .card {
        padding: 16px;
    }
}

/* ---------- Scrollbar ---------- */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ---------- Selection ---------- */
::selection {
    background: rgba(229, 74, 137, 0.2);
    color: var(--color-text);
}

/* ---------- Print ---------- */
@media print {
    .sidebar,
    .sidebar-toggle,
    .sidebar-overlay {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
}
