/* ==========================================================================
   UGB Dashboard — Université Gaston Berger
   Plateforme de suivi des diplômés
   ========================================================================== */

/* ------------------------------------------------------------------
   Variables
   ------------------------------------------------------------------ */
:root {
    --primary:        #B45D2E;
    --primary-dark:   #8B4520;
    --primary-light:  #f5e6dc;
    --secondary:      #1e293b;
    --bg:             #f1f5f9;
    --card-bg:        #ffffff;
    --border:         #e2e8f0;
    --text:           #1e293b;
    --text-muted:     #64748b;

    /* Alias rétrocompatibilité (anciennes variables encore présentes dans les vues) */
    --ugb-primary:    #B45D2E;
    --ugb-secondary:  #8B4520;
    --ugb-accent:     #3b82f6;
    --ugb-light-blue: #f1f5f9;
    --ugb-dark:       #1e293b;
    --ugb-gray:       #64748b;
    --ugb-light-gray: #f8fafc;
    --ugb-orange:     #B45D2E;
    --success:        #10b981;
    --success-light:  #d1fae5;
    --warning:        #f59e0b;
    --warning-light:  #fef3c7;
    --info:           #3b82f6;
    --info-light:     #dbeafe;
    --danger:         #ef4444;
    --danger-light:   #fee2e2;
    --shadow-sm:      0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow:         0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg:      0 10px 30px rgba(0,0,0,0.10);
    --radius:         12px;
    --radius-sm:      8px;
    --radius-lg:      16px;
}

/* ------------------------------------------------------------------
   Base
   ------------------------------------------------------------------ */
* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 0.9rem;
}

/* ------------------------------------------------------------------
   Navbar
   ------------------------------------------------------------------ */
.navbar-ugb {
    background: var(--secondary) !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.18);
    padding: 0 0;
    position: sticky;
    top: 0;
    z-index: 1030;
    min-height: 68px;
    display: flex;
    align-items: center;
}

.navbar-ugb .container-fluid {
    min-height: 68px;
}

.navbar-ugb .navbar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    padding: 0.75rem 0;
}

.navbar-ugb .brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.2);
}

.navbar-ugb .brand-text-primary {
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    line-height: 1.25;
}

.navbar-ugb .brand-text-secondary {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    line-height: 1.25;
}

.navbar-ugb .nav-link {
    color: rgba(255,255,255,0.75) !important;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.6rem 1.1rem !important;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 7px;
}

.navbar-ugb .nav-link:hover,
.navbar-ugb .nav-link.active {
    color: #fff !important;
    background: #313d4a;
}

.navbar-ugb .nav-link.active {
    background: var(--primary);
    color: #fff !important;
}

.navbar-ugb .nav-link-danger {
    color: #94a3b8 !important;
}

.navbar-ugb .nav-link-danger:hover {
    color: #fff !important;
    background: #4a2020 !important;
}

.navbar-toggler {
    border: 1px solid rgba(255,255,255,0.2) !important;
    padding: 0.4rem 0.7rem;
}

.navbar-toggler .fa-bars { color: #fff; font-size: 1.1rem; }

/* User badge in navbar */
.navbar-user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #313d4a;
    border-radius: 50px;
    padding: 6px 14px 6px 6px;
    color: #e2e8f0;
    font-size: 0.82rem;
}

.navbar-user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

/* ------------------------------------------------------------------
   Page title bar (remplace le gros page-header)
   ------------------------------------------------------------------ */
.page-title-bar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 0;
    margin-bottom: 1.75rem;
}

.page-title-bar h4 {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text);
    margin: 0;
}

.page-title-bar p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 2px 0 0 0;
}

/* ------------------------------------------------------------------
   Cards
   ------------------------------------------------------------------ */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--card-bg);
}

.card-modern {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--card-bg);
    transition: box-shadow 0.2s ease;
}

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

/* ------------------------------------------------------------------
   Stat cards
   ------------------------------------------------------------------ */
.stat-card {
    background: var(--card-bg) !important;
    border-radius: var(--radius) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
    padding: 1.25rem 1.5rem !important;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: box-shadow 0.2s, transform 0.2s;
    color: var(--text) !important;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    border-radius: 4px 0 0 4px;
    background: var(--primary);
}

.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.info::before    { background: var(--info); }
.stat-card.orange::before  { background: var(--primary); }
.stat-card.accent::before  { background: var(--info); }

.stat-card:hover {
    box-shadow: var(--shadow) !important;
    transform: translateY(-2px);
}

.stat-icon-circle {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-icon-circle.primary { background: var(--primary-light); color: var(--primary); }
.stat-icon-circle.success { background: var(--success-light); color: var(--success); }
.stat-icon-circle.warning { background: var(--warning-light); color: var(--warning); }
.stat-icon-circle.info    { background: var(--info-light);    color: var(--info); }

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text);
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 3px;
    font-weight: 500;
}

/* Legacy overrides pour les pages non encore migrées */
.stat-card h3 { font-size: 2rem; font-weight: 700; margin: 0; color: var(--text) !important; }
.stat-card p  { margin: 0; font-size: 0.78rem; color: var(--text-muted) !important; font-weight: 500; }
.stat-icon    { display: none; }

/* ------------------------------------------------------------------
   Boutons
   ------------------------------------------------------------------ */
.btn-ugb {
    background: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1.25rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: #fff;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(180,93,46,0.25);
}

.btn-ugb:hover, .btn-ugb:focus {
    background: var(--primary-dark);
    color: #fff;
    box-shadow: 0 4px 14px rgba(180,93,46,0.35);
    transform: translateY(-1px);
}

.btn-outline-ugb {
    border: 1.5px solid var(--primary);
    color: var(--primary);
    border-radius: var(--radius-sm);
    padding: 0.5rem 1.25rem;
    font-weight: 600;
    font-size: 0.875rem;
    background: transparent;
    transition: all 0.2s ease;
}

.btn-outline-ugb:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-1px);
}

/* ------------------------------------------------------------------
   Formulaires
   ------------------------------------------------------------------ */
.form-control, .form-select {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    padding: 0.5rem 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    color: var(--text);
}

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

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.4rem;
}

.search-box {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    transition: all 0.2s;
    background: #fff;
}

.search-box:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(180,93,46,0.12);
    outline: none;
}

/* ------------------------------------------------------------------
   Table
   ------------------------------------------------------------------ */
.table-modern {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
}

.table-modern thead {
    background: #f8fafc;
}

.table-modern th {
    border: none;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding: 0.875rem 1rem;
    white-space: nowrap;
}

.table-modern td {
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 0.875rem 1rem;
    vertical-align: middle;
    font-size: 0.875rem;
}

.table-modern tbody tr:last-child td { border-bottom: none; }
.table-modern tbody tr:hover { background: #fafbfc; }

/* ------------------------------------------------------------------
   Badges
   ------------------------------------------------------------------ */
.badge-ugb {
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50px;
    padding: 0.3rem 0.8rem;
    font-weight: 600;
    font-size: 0.75rem;
}

/* ------------------------------------------------------------------
   Selection toolbar
   ------------------------------------------------------------------ */
.selection-toolbar {
    background: var(--secondary);
    border-radius: var(--radius);
    padding: 0.875rem 1.25rem;
    color: white;
    margin-bottom: 1rem;
    transform: translateY(-8px);
    opacity: 0;
    transition: all 0.25s ease;
    display: none;
}

.selection-toolbar.show {
    transform: translateY(0);
    opacity: 1;
    display: block;
}

.btn-selection {
    background: #313d4a;
    border: 1px solid #4a5568;
    color: #e2e8f0;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    padding: 0.4rem 0.9rem;
    transition: all 0.2s;
}

.btn-selection:hover {
    background: #3d4a5c;
    color: #fff;
}

/* ------------------------------------------------------------------
   Checkboxes
   ------------------------------------------------------------------ */
.checkbox-diplome, .checkbox-master {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 2px solid var(--border);
    transition: all 0.15s;
    cursor: pointer;
    accent-color: var(--primary);
}

.checkbox-diplome:checked, .checkbox-master:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.table-row-selected {
    background-color: var(--primary-light) !important;
}

/* ------------------------------------------------------------------
   Pagination
   ------------------------------------------------------------------ */
.pagination-wrapper {
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.pagination-info {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.pagination {
    margin: 0;
    --bs-pagination-padding-x: 0.75rem;
    --bs-pagination-padding-y: 0.4rem;
    --bs-pagination-font-size: 0.8rem;
    --bs-pagination-color: var(--primary);
    --bs-pagination-bg: #fff;
    --bs-pagination-border-color: var(--border);
    --bs-pagination-border-radius: var(--radius-sm);
    --bs-pagination-hover-color: #fff;
    --bs-pagination-hover-bg: var(--primary);
    --bs-pagination-hover-border-color: var(--primary);
    --bs-pagination-active-color: #fff;
    --bs-pagination-active-bg: var(--primary);
    --bs-pagination-active-border-color: var(--primary);
    --bs-pagination-disabled-color: var(--text-muted);
}

.pagination .page-link {
    border-radius: var(--radius-sm) !important;
    font-weight: 500;
    transition: all 0.15s;
}

/* ------------------------------------------------------------------
   Alerts
   ------------------------------------------------------------------ */
.alert {
    border-radius: var(--radius);
    border: none;
    font-size: 0.875rem;
}

.alert-success {
    background: var(--success-light);
    color: #065f46;
}

.alert-danger {
    background: var(--danger-light);
    color: #991b1b;
}

.alert-info {
    background: var(--info-light);
    color: #1e40af;
    border-left: 3px solid var(--info);
}

/* ------------------------------------------------------------------
   Empty state
   ------------------------------------------------------------------ */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state .icon {
    font-size: 3.5rem;
    color: var(--border);
    margin-bottom: 1.25rem;
}

.empty-state h4 {
    color: var(--text);
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ------------------------------------------------------------------
   Modal
   ------------------------------------------------------------------ */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
}

.modal-title {
    font-weight: 700;
    font-size: 1rem;
}

/* ------------------------------------------------------------------
   Card header liste diplômés
   ------------------------------------------------------------------ */
.card-header-ugb {
    background: #fff;
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0 !important;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header-ugb h5, .card-header-ugb h6 {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
    margin: 0;
}

/* ------------------------------------------------------------------
   Animations
   ------------------------------------------------------------------ */
.fade-in {
    animation: fadeInUp 0.4s ease-out both;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------------
   Checkmark animation
   ------------------------------------------------------------------ */
.success-checkmark .check-icon {
    width: 70px; height: 70px;
    border-radius: 50%;
    background: var(--success);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 2rem;
    margin: 0 auto;
}

@keyframes successPop {
    0%   { transform: scale(0); opacity: 0; }
    60%  { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

.success-animation { animation: successPop 0.5s ease-out; }

/* ------------------------------------------------------------------
   Confidentiality popup
   ------------------------------------------------------------------ */
.confidentiality-popup {
    border-radius: 16px !important;
    padding: 1.5rem !important;
}

.btn-confidentiality-confirm {
    padding: 0.875rem 2rem !important;
    font-weight: 700 !important;
    border-radius: var(--radius-sm) !important;
}

/* ------------------------------------------------------------------
   Sidebar layout
   ------------------------------------------------------------------ */
.sidebar {
    width: 260px;
    height: 100vh;
    background: var(--secondary);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: clip;
    transition: transform 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
    min-height: 88px;
    display: flex;
    align-items: center;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    width: 100%;
}

.sidebar-logo {
    width: 52px;
    height: 52px;
    min-width: 52px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.2);
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}

.sidebar-brand-primary {
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    line-height: 1.3;
}

.sidebar-brand-secondary {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.45);
    line-height: 1.3;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.3);
    padding: 0 0.5rem;
    margin-bottom: 0.5rem;
    display: block;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.65rem 0.875rem;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.sidebar-link:hover {
    color: #fff;
    background: #2a3649;
}

.sidebar-link.active {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 2px 8px rgba(180,93,46,0.35);
}

.sidebar-link-icon {
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 0.875rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-user-info {
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.4);
    white-space: nowrap;
}

.sidebar-logout-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    padding: 0.4rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.18s ease;
    flex-shrink: 0;
    line-height: 1;
}

.sidebar-logout-btn:hover {
    color: #fff;
    background: #3d2020;
}

/* Main content wrapper */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* Mobile topbar */
.mobile-topbar {
    height: 64px;
    background: var(--secondary);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.hamburger-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 1.1rem;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.18s;
    line-height: 1;
}

.hamburger-btn:hover {
    color: #fff;
    background: #2e3d50;
}

.mobile-brand-link {
    display: flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
}

.mobile-brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.15);
}

.mobile-brand-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
}

/* Overlay mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1039;
    border: none;
    padding: 0;
    cursor: pointer;
}

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

body.sidebar-open {
    overflow: hidden;
}

/* ------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------ */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .stat-card { padding: 1rem !important; }
    .stat-number { font-size: 1.6rem; }
    .page-title-bar { padding: 1rem 0; }
    .pagination-wrapper { flex-direction: column; align-items: flex-start; }
    .table-modern th, .table-modern td { padding: 0.65rem 0.75rem; }
}
