@charset "UTF-8";

/* ============================================================
   FLEXIDRIVER ADMIN — DARK THEME CSS
   ============================================================ */

:root {
    --bg-dark:      #0a0a0a;
    --bg-sidebar:   #0d0d0d;
    --bg-content:   #111111;
    --bg-card:      #1a1a1a;
    --bg-input:     #222222;
    --border:       #2a2a2a;
    --border-light: #333333;
    --text-primary:   #ffffff;
    --text-secondary: #999999;
    --text-muted:     #555555;
    --accent:       #f15a24;
    --accent-hover: #e04f1f;
    --success:      #22c55e;
    --warning:      #eab308;
    --danger:       #ef4444;
    --info:         #3b82f6;
}

/* ============================================================
   RESET & BASE
   ============================================================ */

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

html, body {
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    font-size: 14px;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

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

img {
    max-width: 100%;
    display: block;
}

/* ============================================================
   LAYOUT — 1/3 SIDEBAR + 2/3 CONTENT
   ============================================================ */

.layout.admin-layout {
    display: flex !important;
    flex-direction: row !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    overflow: hidden;
}

/* Sidebar — 1/3 par défaut (login) */
.sidebar.admin-sidebar {
    flex: 0 0 33.333% !important;
    max-width: 33.333%;
    width: 33.333%;
    background: var(--bg-sidebar);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Content — 2/3 par défaut (login) */
.content.admin-content {
    flex: 0 0 66.666% !important;
    max-width: 66.666%;
    width: 66.666%;
    background: var(--bg-content);
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

/* Dashboard uniquement — sidebar 1/6 */
body.page-admin .sidebar.admin-sidebar {
    flex: 0 0 16.666% !important;
    max-width: 16.666% !important;
    width: 16.666% !important;
}

/* Dashboard uniquement — contenu 5/6 */
body.page-admin .content.admin-content {
    flex: 0 0 83.333% !important;
    max-width: 83.333% !important;
    width: 83.333% !important;
}

/* ============================================================
   SIDEBAR INTERNALS
   ============================================================ */

.sidebar-header {
    padding: 24px 16px 20px;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.sidebar-header .logo {
    width: 100%;
    max-width: 120px;
    height: auto;
    margin: 0 auto 12px;
}

/* Dashboard — logo et label plus grands */
body.page-admin .sidebar-header .logo {
    max-width: 160px;
}

body.page-admin .sidebar-header .admin-label {
    font-size: 13px !important;
    letter-spacing: 0.2em !important;
}

.sidebar-header .admin-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Nav */
.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-muted);
    padding: 16px 28px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
    border-left: 3px solid transparent;
    cursor: pointer;
    position: relative;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border-left-color: var(--border-light);
    text-decoration: none;
}

.nav-item.active {
    color: var(--accent);
    background: rgba(241, 90, 36, 0.08);
    border-left-color: var(--accent);
    font-weight: 600;
}

.nav-item .nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-item .nav-text {
    flex: 1;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 20px 28px;
    border-top: 1px solid var(--border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

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

.user-details .user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-details .user-role {
    font-size: 11px;
    color: var(--text-muted);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-decoration: none;
    justify-content: center;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
    text-decoration: none;
}

/* ============================================================
   CONTENT INTERNALS
   ============================================================ */

.content-inner {
    padding: 36px 40px;
    min-height: 100%;
}

/* Page Header */
.page-header {
    margin-bottom: 32px;
}

.page-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.page-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.page-accent-line {
    width: 48px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
    margin-top: 12px;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    border: 1px solid transparent;
    white-space: nowrap;
    line-height: 1;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
    text-decoration: none;
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-light);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: #444;
    color: var(--text-primary);
    text-decoration: none;
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: var(--danger);
    text-decoration: none;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-icon {
    padding: 7px 10px;
    font-size: 14px;
}

/* ============================================================
   CARD
   ============================================================ */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 22px;
}

/* ============================================================
   TABLE
   ============================================================ */

.table-wrapper {
    overflow-x: auto;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table.data-table thead th {
    padding: 12px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    background: transparent;
}

table.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

table.data-table tbody tr:last-child {
    border-bottom: none;
}

table.data-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.015);
}

table.data-table tbody tr:hover {
    background: rgba(241, 90, 36, 0.05);
}

table.data-table tbody td {
    padding: 12px 14px;
    color: var(--text-primary);
    vertical-align: middle;
}

table.data-table .td-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Table empty state */
.table-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.table-empty .empty-icon {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.4;
}

/* ============================================================
   BADGES
   ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success  { background: rgba(34, 197, 94, 0.15);  color: #4ade80; }
.badge-danger   { background: rgba(239, 68, 68, 0.15);  color: #f87171; }
.badge-warning  { background: rgba(234, 179, 8, 0.15);  color: #facc15; }
.badge-info     { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-accent   { background: rgba(241, 90, 36, 0.15);  color: #f15a24; }
.badge-muted    { background: rgba(255, 255, 255, 0.06); color: var(--text-secondary); }
.badge-purple   { background: rgba(168, 85, 247, 0.15); color: #c084fc; }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row.cols-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

label, .form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 7px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(241, 90, 36, 0.12);
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

select option {
    background: var(--bg-input);
    color: var(--text-primary);
}

textarea {
    resize: vertical;
    min-height: 90px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 17px;
    height: 17px;
    min-width: 17px;
    accent-color: var(--accent);
    cursor: pointer;
    margin: 0;
    padding: 0;
}

.form-check-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
}

/* Inline select inside table */
select.inline-select {
    padding: 5px 10px;
    font-size: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-primary);
    min-width: 140px;
}

/* ============================================================
   MODAL
   ============================================================ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.2s ease;
    overflow: hidden;
}

.modal.modal-lg {
    max-width: 720px;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-16px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-title-accent {
    color: var(--accent);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    flex-shrink: 0;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

/* ============================================================
   TABS
   ============================================================ */

.tabs {
    display: flex;
    gap: 2px;
    background: var(--bg-dark);
    padding: 4px;
    border-radius: 8px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.tab-btn {
    flex: 1;
    padding: 9px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
    background: var(--accent);
    color: #fff;
}

/* ============================================================
   STATS / DASHBOARD CARDS
   ============================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
}

.stat-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-value.accent { color: var(--accent); }

/* ============================================================
   ALERTS / TOASTS
   ============================================================ */

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-success { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.25); color: #4ade80; }
.alert-danger   { background: rgba(239, 68, 68, 0.1);  border: 1px solid rgba(239, 68, 68, 0.25);  color: #f87171; }
.alert-warning  { background: rgba(234, 179, 8, 0.1);  border: 1px solid rgba(234, 179, 8, 0.25);  color: #facc15; }
.alert-info     { background: rgba(59, 130, 246, 0.1); border: 1px solid rgba(59, 130, 246, 0.25); color: #60a5fa; }

/* Toast notification */
#toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 2000;
    display: none;
    min-width: 280px;
    max-width: 400px;
}

#toast .toast-inner {
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    animation: toastIn 0.25s ease;
}

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

/* ============================================================
   LOADING SPINNER
   ============================================================ */

.spinner-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    gap: 12px;
    font-size: 13px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================================
   LOAD MORE / PAGINATION
   ============================================================ */

.load-more-bar {
    display: flex;
    justify-content: center;
    padding: 20px;
    border-top: 1px solid var(--border);
}

/* ============================================================
   MISC UTILITIES
   ============================================================ */

.text-accent   { color: var(--accent); }
.text-muted    { color: var(--text-muted); }
.text-secondary{ color: var(--text-secondary); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-warning  { color: var(--warning); }
.fw-600        { font-weight: 600; }
.fw-700        { font-weight: 700; }
.font-mono     { font-family: "SF Mono", "Fira Code", Consolas, monospace; }
.truncate      { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #444; }

/* ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */

@media (max-width: 900px) {
    .layout.admin-layout {
        position: relative;
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .sidebar.admin-sidebar {
        flex: 0 0 auto !important;
        max-width: 100%;
        width: 100% !important;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow: visible;
    }

    .content.admin-content {
        flex: 1 1 auto !important;
        max-width: 100%;
        width: 100% !important;
        overflow: visible;
    }

    .sidebar-nav {
        display: none;
    }

    .sidebar-nav.mobile-open {
        display: block;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-row.cols-3 {
        grid-template-columns: 1fr;
    }

    .content-inner {
        padding: 24px 20px;
    }

    .page-header-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .modal {
        max-width: 100%;
        max-height: 95vh;
        margin: 0;
    }
}

/* ============================================================
   SEARCH BAR
   ============================================================ */

.search-bar {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-input-wrap {
    flex: 1;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 9px 14px 9px 48px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--accent);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
    line-height: 1;
}

.search-results-count {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 80px;
    text-align: right;
}

/* ============================================================
   SORTABLE COLUMN HEADERS
   ============================================================ */

th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: color 0.15s;
}

th.sortable:hover {
    color: var(--accent);
}

th.sortable .sort-icon {
    display: inline-block;
    margin-left: 5px;
    font-size: 10px;
    opacity: 0.35;
    font-style: normal;
}

th.sortable:hover .sort-icon {
    opacity: 0.7;
}

th.sort-asc,
th.sort-desc {
    color: var(--accent);
}

th.sort-asc .sort-icon,
th.sort-desc .sort-icon {
    opacity: 1;
}
