/* ============================================================
   backend.css — Feuille de style commune Backend Portfolio
   ============================================================ */

/* ── Variables ── */
:root {
    --bg-main:    #f5f5f5;
    --bg-white:   #ffffff;
    --bg-header:  #222222;
    --text-main:  #333333;
    --text-sec:   #666666;
    --accent:     #333333;
    --border:     #dddddd;
    --border-lt:  #eeeeee;
    --danger:     #d9534f;
    --success:    #28a745;
    --warning:    #ffc107;
    --radius:     4px;
    --shadow-sm:  0 2px 4px rgba(0,0,0,.06);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: inherit; text-decoration: none; }

/* ── Header ── */
header {
    background: var(--bg-header);
    color: #fff;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
header a { color: #fff; }
.header-brand { font-weight: bold; letter-spacing: 1px; }
.user-info { display: flex; align-items: center; gap: 8px; font-size: .9rem; }

.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.role-superadmin { background: #7c3aed; color: #fff; }
.role-admin       { background: #0891b2; color: #fff; }
.role-invité      { background: #65a30d; color: #fff; }

/* ── Navigation ── */
.nav-toggle { display: none !important; }

.nav-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin: 0 20px 0;
    padding: 10px 0 0;
    border-bottom: 2px solid var(--border);
    gap: 2px;
}
.nav-main a {
    text-decoration: none;
    color: var(--text-sec);
    padding: 6px 12px 8px;
    font-size: .92rem;
    border-radius: var(--radius) var(--radius) 0 0;
    transition: color .15s, background .15s;
}
.nav-main a:hover { color: var(--text-main); background: rgba(0,0,0,.04); }
.nav-main a.active {
    color: var(--text-main);
    font-weight: 600;
    border-bottom: 2px solid var(--accent);
    margin-bottom: -2px;
    background: var(--bg-white);
}
.nav-site { margin-left: auto !important; font-size: .85rem !important; }

/* ── Main Content ── */
main {
    max-width: 1200px;
    margin: 25px auto;
    padding: 0 20px;
}

/* ── Tableaux ── */
table { width: 100%; border-collapse: collapse; background: var(--bg-white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); margin-top: 15px; }
th { background: #f4f4f4; padding: 11px 10px; border-bottom: 2px solid var(--border); text-align: left; font-size: .87rem; font-weight: 600; }
td { padding: 9px 10px; border-bottom: 1px solid var(--border-lt); font-size: .88rem; vertical-align: middle; }
tbody tr:hover { background: #fafafa; }
tbody tr:last-child td { border-bottom: none; }

/* ── Formulaires ── */
.filter-bar {
    background: var(--bg-white);
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}
.filter-bar input, .filter-bar select {
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .88rem;
}
.filter-bar > div { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 5px; font-size: .9rem; }
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .9rem;
    font-family: inherit;
    transition: border-color .15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { outline: none; border-color: #888; }
.hint { font-size: .8rem; color: var(--text-sec); margin-top: 4px; }

/* ── Boutons et Icônes ── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-lt);
    flex-wrap: wrap;
}
.btn-icon {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: transform .12s, opacity .12s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover { transform: scale(1.15); opacity: .8; }
.btn-delete { margin-left: auto; color: var(--danger); }

/* ── Messages ── */
.error-box {
    background: #fdf7f7;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 12px 15px;
    margin-bottom: 18px;
    border-radius: var(--radius);
    font-size: .9rem;
}
.success-box {
    background: #f0faf4;
    border: 1px solid var(--success);
    color: #155724;
    padding: 12px 15px;
    margin-bottom: 18px;
    border-radius: var(--radius);
    font-size: .9rem;
}

/* ── Dashboard ── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.card {
    background: var(--bg-white);
    padding: 20px;
    border: 1px solid var(--border-lt);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card h3 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-lt);
    font-size: 1rem;
}
.log-item { font-size: .85rem; padding: 5px 0; border-bottom: 1px dotted var(--border-lt); }
.log-item:last-child { border-bottom: none; }

/* ── Colonnes spéciales ── */
.col-shrink  { width: 1%; white-space: nowrap; }
.mobile-hide { /* visible par défaut */ }

/* ── Page de Login ── */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-main);
    padding: 20px;
}
.login-box {
    background: var(--bg-white);
    padding: 35px 40px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
    width: 100%;
    max-width: 380px;
}
.login-box h1 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 5px;
    letter-spacing: .5px;
}
.login-box .login-subtitle {
    font-size: .85rem;
    color: var(--text-sec);
    margin-bottom: 25px;
}
.login-box .form-group input {
    width: 100%;
}
.login-box .btn-submit {
    width: 100%;
    padding: 11px;
    background: var(--bg-header);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s;
    margin-top: 5px;
}
.login-box .btn-submit:hover { background: #444; }
.login-error {
    background: #fdf7f7;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 10px 13px;
    border-radius: var(--radius);
    font-size: .88rem;
    margin-bottom: 15px;
}

/* ── Responsive ── */
@media (max-width: 800px) {
    .nav-toggle {
        display: flex !important;
        background: #333;
        color: #fff;
        border: none;
        padding: 0;
        width: 44px;
        height: 44px;
        text-align: center;
        font-size: 1.4rem;
        cursor: pointer;
        margin: 8px 0 0 15px;
        border-radius: var(--radius);
        align-items: center;
        justify-content: center;
    }
    .nav-toggle:hover { background: #444; }

    .nav-main {
        display: none;
        flex-direction: column;
        margin: 0;
        padding: 0;
        border-bottom: none;
        background: var(--bg-white);
        border-bottom: 1px solid var(--border);
        box-shadow: 0 3px 6px rgba(0,0,0,.08);
    }
    .nav-main.open { display: flex; }
    .nav-main a {
        display: block;
        padding: 13px 20px;
        border-radius: 0;
        border-bottom: 1px solid var(--border-lt);
        margin-bottom: 0;
    }
    .nav-main a.active { border-bottom: 1px solid var(--border-lt); background: #f0f0f0; }
    .nav-site { margin-left: 0 !important; }

    .filter-bar { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px; }
    .filter-bar > div { flex-wrap: wrap; }
    .filter-bar input, .filter-bar select { flex: 1 1 120px; }
    .filter-bar input[type="text"] { flex: 1 1 100%; }

    .mobile-hide { display: none !important; }
    table { font-size: .82rem; }
    th, td { padding: 7px 5px; }
    td img { width: 50px !important; height: 35px !important; }
    .btn-icon { font-size: 1.1rem; }

    main { margin: 15px auto; padding: 0 12px; }
}