/* ============================================
   Serrure Intelligente - CSS
   ============================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --blue:       #1565C0;
    --blue-dark:  #0D47A1;
    --blue-light: #E3F2FD;
    --green:      #2DC653;
    --green-bg:   #E8F5E9;
    --red:        #E63946;
    --red-bg:     #FFEBEE;
    --orange:     #FF8C00;
    --purple:     #7209B7;
    --purple-bg:  #F3E5F5;
    --bg:         #F2F4F8;
    --card:       #FFFFFF;
    --text:       #1A1A2E;
    --muted:      #6B7280;
    --border:     #E5E7EB;
    --radius:     12px;
    --shadow:     0 2px 12px rgba(0,0,0,0.08);
}

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

/* ── NAVBAR ── */
.navbar {
    background: linear-gradient(135deg, var(--blue), var(--blue-dark));
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 60px;
    gap: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand {
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.nav-links {
    display: flex;
    list-style: none;
    gap: 4px;
    flex: 1;
}
.nav-links a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 14px;
    transition: background 0.2s;
}
.nav-links a:hover,
.nav-links a.active {
    background: rgba(255,255,255,0.2);
    color: #fff;
}
.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    white-space: nowrap;
}

/* ── CONTAINER ── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* ── PAGE HEADER ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h2 {
    font-size: 22px;
    font-weight: 700;
}

/* ── STATS GRID ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    border-left: 4px solid transparent;
}
.stat-blue   { border-color: var(--blue);   }
.stat-green  { border-color: var(--green);  }
.stat-red    { border-color: var(--red);    }
.stat-purple { border-color: var(--purple); }
.stat-icon   { font-size: 32px; }
.stat-number { font-size: 28px; font-weight: 800; line-height: 1; }
.stat-label  { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ── CARD ── */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 16px; font-weight: 600; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.table th {
    background: #F8FAFC;
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td     { background: #F8FAFC; }
code.mac {
    background: var(--blue-light);
    color: var(--blue);
    padding: 2px 8px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 13px;
}
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── BADGES ── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-green { background: var(--green-bg);  color: #1B5E20; }
.badge-red   { background: var(--red-bg);    color: #B71C1C; }
.serrure-badge {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
}

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: opacity 0.15s, transform 0.1s;
}
.btn:hover   { opacity: 0.88; }
.btn:active  { transform: scale(0.97); }
.btn-block   { width: 100%; justify-content: center; }
.btn-sm      { padding: 5px 12px; font-size: 13px; }
.btn-primary { background: var(--blue);   color: #fff; }
.btn-success { background: var(--green);  color: #fff; }
.btn-danger  { background: var(--red);    color: #fff; }
.btn-warning { background: var(--orange); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline-white { background: transparent; border: 1.5px solid rgba(255,255,255,0.5); color: #fff; }

/* ── FORMS ── */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: #fff;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--blue);
}
.form-group small { color: var(--muted); font-size: 12px; margin-top: 4px; display: block; }
.checkbox-group label { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); cursor: pointer; }
.checkbox-group input[type=checkbox] { width: auto; }

/* ── ALERTS ── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}
.alert-success { background: var(--green-bg); color: #1B5E20; border: 1px solid #A5D6A7; }
.alert-error   { background: var(--red-bg);   color: #B71C1C; border: 1px solid #EF9A9A; }

/* ── SEARCH BAR ── */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.search-bar input {
    flex: 1;
    min-width: 220px;
    padding: 9px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}
.search-bar input:focus { outline: none; border-color: var(--blue); }

/* ── FILTERS ── */
.filter-card { padding: 16px 20px; }
.filters-form {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.filter-group label { font-size: 12px; font-weight: 600; color: var(--muted); }
.filter-group input,
.filter-group select {
    padding: 8px 10px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
}
.filter-btns { flex-direction: row; align-items: center; gap: 8px; }

/* ── PAGINATION ── */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    padding: 16px;
    flex-wrap: wrap;
}
.page-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1.5px solid var(--border);
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s;
}
.page-btn:hover { background: var(--blue-light); }
.page-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ── MODAL ── */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-content {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--muted);
    padding: 4px 8px;
    border-radius: 6px;
}
.modal-close:hover { background: var(--red-bg); color: var(--red); }
.modal-content form { padding: 20px 24px; }
.modal-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}

/* ── LOGIN PAGE ── */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 60%, #4361EE 100%);
}
.login-wrap { width: 100%; max-width: 400px; padding: 16px; }
.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 36px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-header {
    text-align: center;
    margin-bottom: 28px;
}
.lock-icon-big { font-size: 48px; margin-bottom: 10px; }
.login-header h1 { font-size: 20px; font-weight: 800; color: var(--text); }
.login-header p  { font-size: 13px; color: var(--muted); margin-top: 4px; }
.login-hint { text-align: center; font-size: 12px; color: var(--muted); margin-top: 16px; }
.login-hint code { background: #F0F4FF; padding: 1px 6px; border-radius: 4px; color: var(--blue); }

/* ── UTILITIES ── */
.text-center { text-align: center; }
.text-muted  { color: var(--muted); font-size: 13px; }
.header-actions { display: flex; align-items: center; gap: 12px; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .filters-form { flex-direction: column; }
    .filter-group { min-width: 100%; }
    .actions { flex-direction: column; }
}
