/* ============================================================
   PROJET : Gestion de Prêt Matériel
   FICHIER : assets/css/style.css
   DESCRIPTION : Feuille de style principale - responsive
   ============================================================ */

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

:root {
    --primary:      #0078d4;   /* Bleu Microsoft */
    --primary-dark: #005a9e;
    --success:      #107c10;
    --danger:       #d13438;
    --warning:      #ff8c00;
    --gray-50:      #f8f9fa;
    --gray-100:     #f1f3f4;
    --gray-200:     #e8eaed;
    --gray-400:     #9aa0a6;
    --gray-600:     #5f6368;
    --gray-800:     #3c4043;
    --white:        #ffffff;
    --shadow-sm:    0 1px 3px rgba(0,0,0,.12);
    --shadow-md:    0 4px 12px rgba(0,0,0,.15);
    --radius:       8px;
    --radius-sm:    4px;
    --nav-height:   60px;
}

html { font-size: 16px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: 'Courier New', monospace; font-size: .875em; background: var(--gray-100); padding: 2px 6px; border-radius: var(--radius-sm); }

/* --- Navigation --- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-height);
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1.5rem;
    box-shadow: var(--shadow-md);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
}

.nav-icon { font-size: 1.3rem; }

.nav-menu {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex: 1;
}

.nav-link {
    color: rgba(255,255,255,.85);
    padding: .4rem .75rem;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    transition: background .15s;
}
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.15); color: var(--white); text-decoration: none; }

.btn-primary-sm {
    background: var(--white);
    color: var(--primary) !important;
    font-weight: 600;
    padding: .35rem .9rem !important;
}
.btn-primary-sm:hover { background: var(--gray-100) !important; }

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
    white-space: nowrap;
}

.user-name { font-size: .9rem; opacity: .85; }
.logout { font-size: .85rem; }

/* --- Contenu principal --- */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 3rem;
}

.page-header {
    margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: .25rem; }
.page-header p { color: var(--gray-600); }

/* --- Grille statistiques --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid transparent;
}

.stat-blue  { border-left-color: var(--primary); }
.stat-green { border-left-color: var(--success); }
.stat-gray  { border-left-color: var(--gray-400); }
.stat-red   { border-left-color: var(--danger); }

.stat-icon { font-size: 1.8rem; }
.stat-number { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .85rem; color: var(--gray-600); margin-top: .2rem; }

/* --- Cartes --- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}
.card-header h2 { font-size: 1.1rem; font-weight: 600; }

.card-footer {
    padding: .75rem 1.25rem;
    border-top: 1px solid var(--gray-200);
    font-size: .9rem;
}

/* --- Tableaux --- */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.table thead tr { background: var(--gray-50); }
.table th { padding: .75rem 1rem; text-align: left; font-weight: 600; color: var(--gray-600); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.table td { padding: .75rem 1rem; border-top: 1px solid var(--gray-200); }
.table tbody tr:hover { background: var(--gray-50); }
.table .row-retard { background: #fff5f5; }
.table .row-retard:hover { background: #ffe8e8; }

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: .2rem .5rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
}
.badge-red    { background: #fde8e8; color: var(--danger); }
.badge-green  { background: #e6f4ea; color: var(--success); }
.badge-blue   { background: #e3f2fd; color: var(--primary); }
.badge-gray   { background: var(--gray-200); color: var(--gray-600); }

/* --- Boutons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem 1rem;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-800);
    text-decoration: none;
    transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--gray-50); text-decoration: none; }

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

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

.btn-sm { padding: .3rem .65rem; font-size: .8rem; }

/* --- État vide --- */
.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--gray-600);
}
.empty-state p { margin-bottom: 1rem; }

/* --- Page Login --- */
.login-page {
    background: linear-gradient(135deg, #0078d4 0%, #005a9e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.login-header {
    background: var(--gray-50);
    padding: 2rem 2rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--gray-200);
}
.login-logo { font-size: 3rem; margin-bottom: .5rem; }
.login-header h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: .25rem; }
.login-header p { color: var(--gray-600); font-size: .9rem; }

.login-body {
    padding: 2rem;
    text-align: center;
}
.login-desc { color: var(--gray-600); font-size: .9rem; margin-bottom: 1.5rem; }

.btn-microsoft {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    background: var(--white);
    border: 2px solid var(--gray-200);
    color: var(--gray-800);
    padding: .75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
    justify-content: center;
}
.btn-microsoft:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,120,212,.15);
    text-decoration: none;
    color: var(--gray-800);
}

.login-footer {
    padding: 1rem 2rem;
    text-align: center;
    border-top: 1px solid var(--gray-200);
    color: var(--gray-400);
}

/* --- Formulaires --- */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .9rem; font-weight: 500; margin-bottom: .4rem; }
.form-control {
    width: 100%;
    padding: .5rem .75rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: .95rem;
    font-family: inherit;
    transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,120,212,.15); }
.form-text { font-size: .8rem; color: var(--gray-600); margin-top: .25rem; }

/* --- Alertes --- */
.alert {
    padding: .85rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: .9rem;
    border-left: 4px solid;
}
.alert-success { background: #e6f4ea; border-color: var(--success); color: #0a5c0a; }
.alert-danger   { background: #fde8e8; border-color: var(--danger);  color: #8b1a1a; }
.alert-warning  { background: #fff3e0; border-color: var(--warning); color: #7a4000; }
.alert-info     { background: #e3f2fd; border-color: var(--primary); color: #0d47a1; }

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 1rem;
    color: var(--gray-400);
    font-size: .8rem;
    border-top: 1px solid var(--gray-200);
    background: var(--white);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .nav-menu { display: none; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .table { font-size: .8rem; }
    .table th, .table td { padding: .5rem .75rem; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .main-content { padding: 1rem; }
}

/* --- Onglets filtre --- */
.tab-bar {
    display: flex;
    gap: .25rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--gray-200);
}

.tab {
    padding: .6rem 1.1rem;
    font-size: .9rem;
    color: var(--gray-600);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    transition: color .15s;
}
.tab:hover { color: var(--primary); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.tab-count {
    background: var(--gray-200);
    color: var(--gray-600);
    border-radius: 20px;
    padding: .1rem .45rem;
    font-size: .75rem;
    font-weight: 600;
}
.tab.active .tab-count { background: #e3f2fd; color: var(--primary); }

/* --- Ligne archivée dans les tableaux --- */
.row-archive { opacity: .6; font-style: italic; }
.row-archive:hover { opacity: .8; }

/* --- Champ obligatoire --- */
.required { color: var(--danger); margin-left: 2px; }

/* --- Texte muted --- */
.text-muted { color: var(--gray-400); font-size: .85em; }
