/**
 * Journal RP — Styles panel d'administration (modernisé)
 * Mode sombre/clair, bords arrondis, animations, hover effects
 * Toutes couleurs via variables CSS — ZÉRO valeur en dur
 */

/* === Reset === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 15px; scroll-behavior: smooth; }
body { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; line-height: 1.6; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* === Animations === */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.anim-fadeup {
    animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anim-delay-1 { animation-delay: 0.05s; }
.anim-delay-2 { animation-delay: 0.1s; }
.anim-delay-3 { animation-delay: 0.15s; }
.anim-delay-4 { animation-delay: 0.2s; }

/* ============================================================
   LAYOUT
   ============================================================ */
.admin-body {
    background-color: var(--admin-bg);
    color: var(--admin-text);
    min-height: 100vh;
    display: flex;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.admin-sidebar {
    width: 250px;
    background-color: var(--admin-sidebar);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.4s ease;
    border-right: 1px solid var(--admin-border);
}

.sidebar-header {
    padding: 24px 22px 18px;
    border-bottom: 1px solid var(--admin-border);
}

.sidebar-brand {
    display: block;
    transition: opacity 0.2s;
}

.sidebar-brand:hover { opacity: 0.8; }

.sidebar-logo { max-height: 36px; margin-bottom: 4px; }

.sidebar-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--admin-accent);
    letter-spacing: -0.01em;
}

.sidebar-subtitle {
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    opacity: 0.3;
    margin-top: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 14px 10px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 14px;
    font-size: 0.87rem;
    font-weight: 500;
    color: var(--admin-text);
    opacity: 0.55;
    border-radius: 10px;
    transition: all 0.25s ease;
    margin-bottom: 2px;
    position: relative;
}

.sidebar-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.sidebar-link:hover {
    opacity: 1;
    background-color: var(--admin-hover);
    transform: translateX(2px);
}

.sidebar-link:hover svg {
    transform: scale(1.1);
}

.sidebar-link.active {
    opacity: 1;
    color: var(--admin-accent);
    background-color: rgba(200, 155, 60, 0.08);
}

[data-theme="light"] .sidebar-link.active {
    background-color: rgba(200, 155, 60, 0.12);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background-color: var(--admin-accent);
    border-radius: 0 3px 3px 0;
}

.sidebar-separator {
    height: 1px;
    background-color: var(--admin-border);
    margin: 10px 14px;
}

.sidebar-footer {
    padding: 10px 10px 14px;
    border-top: 1px solid var(--admin-border);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.admin-main {
    margin-left: 250px;
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.35s ease;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.admin-topbar {
    background-color: var(--admin-sidebar);
    padding: 10px 28px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    border-bottom: 1px solid var(--admin-border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: background-color 0.4s ease;
    gap: 12px;
    min-height: 56px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Toggle thème admin */
.admin-theme-toggle {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--admin-border);
    background-color: var(--admin-card);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    overflow: hidden;
}

.admin-theme-toggle:hover {
    border-color: var(--admin-accent);
    transform: rotate(15deg);
}

.admin-theme-toggle .theme-icon {
    width: 16px;
    height: 16px;
    color: var(--admin-text);
    position: absolute;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] .admin-theme-toggle .theme-icon--sun { opacity: 1; transform: rotate(0) scale(1); }
[data-theme="dark"] .admin-theme-toggle .theme-icon--moon { opacity: 0; transform: rotate(-90deg) scale(0.5); }
[data-theme="light"] .admin-theme-toggle .theme-icon--sun { opacity: 0; transform: rotate(90deg) scale(0.5); }
[data-theme="light"] .admin-theme-toggle .theme-icon--moon { opacity: 1; transform: rotate(0) scale(1); }

.topbar-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
}

.topbar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.topbar-user-role {
    font-size: 0.68rem;
    opacity: 0.4;
    text-transform: capitalize;
}

.topbar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--admin-border);
    color: var(--admin-text);
    opacity: 0.5;
    transition: all 0.25s ease;
}

.topbar-logout:hover {
    opacity: 1;
    border-color: #c62828;
    color: #c62828;
    background-color: rgba(198, 40, 40, 0.08);
}

.burger-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-right: auto;
    flex-direction: column;
    gap: 5px;
}

.burger-toggle span {
    width: 22px;
    height: 2px;
    background-color: var(--admin-text);
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.burger-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger-toggle.active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.burger-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   CONTENT AREA
   ============================================================ */
.admin-content {
    padding: 28px;
    flex: 1;
    animation: fadeIn 0.3s ease;
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    padding: 14px 20px;
    margin-bottom: 22px;
    border-radius: 12px;
    font-size: 0.87rem;
    border-left: 4px solid var(--admin-accent);
    background-color: var(--admin-card);
    box-shadow: var(--admin-shadow);
    animation: fadeUp 0.4s ease both;
}

.alert-success { border-left-color: #2e7d32; }
.alert-error { border-left-color: #c62828; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 0.85rem;
    opacity: 0.4;
}

.page-actions {
    display: flex;
    gap: 8px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: center;
    line-height: 1.4;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.25s;
}

.btn:hover::after { opacity: 1; }

.btn-primary {
    background-color: var(--admin-accent);
    color: #111;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(200, 155, 60, 0.3);
}

.btn-secondary {
    background-color: var(--admin-card);
    color: var(--admin-text);
    border: 1px solid var(--admin-border);
}

.btn-secondary:hover {
    border-color: var(--admin-accent);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--admin-text);
    border: 1px solid var(--admin-border);
}

.btn-outline:hover {
    border-color: var(--admin-accent);
    color: var(--admin-accent);
    transform: translateY(-1px);
}

.btn-danger {
    background-color: rgba(198, 40, 40, 0.15);
    color: #ef5350;
    border: 1px solid rgba(198, 40, 40, 0.2);
}

.btn-danger:hover {
    background-color: #c62828;
    color: #fff;
    border-color: #c62828;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.76rem;
    border-radius: 8px;
}

.btn-block { display: flex; width: 100%; }

/* ============================================================
   STATS GRID (DASHBOARD)
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    background-color: var(--admin-card);
    border-radius: 14px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    border: 1px solid var(--admin-border);
    transition: all 0.3s ease;
    box-shadow: var(--admin-shadow);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--admin-shadow-lg);
    border-color: var(--admin-accent);
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(200, 155, 60, 0.15), rgba(200, 155, 60, 0.05));
    transition: transform 0.3s ease;
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(-5deg);
}

.stat-icon svg {
    width: 20px;
    height: 20px;
    color: var(--admin-accent);
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.78rem;
    opacity: 0.45;
}

.stat-details {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.73rem;
    opacity: 0.4;
}

/* ============================================================
   DASHBOARD GRID
   ============================================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.dashboard-card {
    background-color: var(--admin-card);
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--admin-border);
    box-shadow: var(--admin-shadow);
    transition: all 0.3s ease;
}

.dashboard-card:hover {
    box-shadow: var(--admin-shadow-lg);
}

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

.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

.card-link {
    font-size: 0.78rem;
    color: var(--admin-accent);
    transition: opacity 0.2s;
}

.card-link:hover { opacity: 0.7; }

.card-body-list {
    padding: 6px 0;
    max-height: 380px;
    overflow-y: auto;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 22px;
    transition: background-color 0.2s ease;
    border-radius: 0;
}

.list-item:hover {
    background-color: var(--admin-hover);
}

.list-item-main {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    display: block;
    font-size: 0.87rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

.list-item-title:hover { color: var(--admin-accent); }

.list-item-meta {
    display: block;
    font-size: 0.73rem;
    opacity: 0.35;
    margin-top: 2px;
}

.empty-text {
    text-align: center;
    padding: 28px;
    opacity: 0.35;
    font-size: 0.87rem;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-block;
    padding: 4px 11px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 8px;
    white-space: nowrap;
}

.badge--draft { background-color: rgba(150,150,150,0.12); color: var(--admin-text); opacity: 0.6; }
.badge--published { background-color: rgba(46, 125, 50, 0.15); color: #66bb6a; }
.badge--archived { background-color: rgba(150,150,150,0.08); opacity: 0.4; }
.badge--sent { background-color: rgba(33, 150, 243, 0.15); color: #64b5f6; }
.badge--paid { background-color: rgba(46, 125, 50, 0.15); color: #66bb6a; }
.badge--cancelled { background-color: rgba(198, 40, 40, 0.15); color: #ef5350; }
.badge--admin { background-color: rgba(200, 155, 60, 0.15); color: var(--admin-accent); }
.badge--editor { background-color: rgba(33, 150, 243, 0.15); color: #64b5f6; }
.badge--journalist { background-color: rgba(150,150,150,0.12); color: var(--admin-text); opacity: 0.6; }

/* ============================================================
   FILTERS
   ============================================================ */
.filters-bar { margin-bottom: 20px; }

.filters-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-input,
.filter-select {
    padding: 9px 16px;
    font-size: 0.85rem;
    background-color: var(--admin-input-bg);
    color: var(--admin-text);
    border: 1px solid var(--admin-border);
    border-radius: 10px;
    transition: all 0.25s ease;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--admin-accent);
    box-shadow: 0 0 0 3px rgba(200, 155, 60, 0.1);
}

/* ============================================================
   TABLES
   ============================================================ */
.table-responsive {
    overflow-x: auto;
    margin-bottom: 20px;
    background-color: var(--admin-card);
    border-radius: 14px;
    border: 1px solid var(--admin-border);
    box-shadow: var(--admin-shadow);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.admin-table thead th {
    padding: 14px 16px;
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.35;
    border-bottom: 1px solid var(--admin-border);
    white-space: nowrap;
    font-weight: 600;
}

.admin-table tbody tr {
    transition: background-color 0.2s ease;
}

.admin-table tbody tr:hover {
    background-color: var(--admin-hover);
}

.admin-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--admin-border);
}

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

.td-title {
    font-weight: 500;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.td-mono {
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.8rem;
}

.td-nowrap { white-space: nowrap; }

.td-actions {
    white-space: nowrap;
    display: flex;
    gap: 6px;
}

/* ============================================================
   FORMS
   ============================================================ */
.edit-form { max-width: 1100px; }
.compact-form { max-width: 560px; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: flex-start;
}

.form-section {
    margin-bottom: 28px;
}

.form-section h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--admin-border);
}

.form-row {
    display: flex;
    gap: 16px;
}

.flex-1 { flex: 1; }

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

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 7px;
    opacity: 0.6;
    letter-spacing: 0.01em;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 16px;
    font-size: 0.87rem;
    background-color: var(--admin-input-bg);
    color: var(--admin-text);
    border: 1px solid var(--admin-border);
    border-radius: 10px;
    font-family: inherit;
    transition: all 0.25s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--admin-accent);
    box-shadow: 0 0 0 3px rgba(200, 155, 60, 0.1);
}

.form-group small {
    display: block;
    font-size: 0.73rem;
    opacity: 0.35;
    margin-top: 5px;
}

.input-lg {
    font-size: 1.2rem !important;
    padding: 14px 16px !important;
    font-weight: 600 !important;
}

.hidden-textarea { display: none; }

/* ============================================================
   SIDEBAR CARDS (IN FORMS)
   ============================================================ */
.sidebar-card {
    background-color: var(--admin-card);
    border-radius: 14px;
    padding: 22px;
    margin-bottom: 16px;
    border: 1px solid var(--admin-border);
    box-shadow: var(--admin-shadow);
}

.sidebar-card h3 {
    font-size: 0.9rem;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--admin-border);
}

/* ============================================================
   IMAGE PREVIEW
   ============================================================ */
.image-preview { margin-bottom: 14px; }

.image-preview img {
    max-height: 150px;
    border-radius: 10px;
    margin-bottom: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    opacity: 0.6;
    cursor: pointer;
}

/* ============================================================
   RICH EDITOR
   ============================================================ */
.editor-toolbar {
    display: flex;
    gap: 2px;
    padding: 8px 10px;
    background-color: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    flex-wrap: wrap;
}

.editor-toolbar button {
    padding: 5px 12px;
    font-size: 0.8rem;
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--admin-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.editor-toolbar button:hover {
    background-color: var(--admin-hover);
    border-color: var(--admin-border);
}

.toolbar-separator {
    width: 1px;
    background-color: var(--admin-border);
    margin: 4px 4px;
}

.rich-editor {
    min-height: 350px;
    padding: 18px;
    background-color: var(--admin-input-bg);
    color: var(--admin-text);
    border: 1px solid var(--admin-border);
    border-radius: 0 0 12px 12px;
    font-size: 0.95rem;
    line-height: 1.7;
    outline: none;
    transition: border-color 0.25s ease;
}

.rich-editor:focus {
    border-color: var(--admin-accent);
}

/* ============================================================
   INVOICE LINES
   ============================================================ */
.invoice-lines-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }

.invoice-lines-table thead th {
    padding: 10px 10px;
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.35;
}

.col-desc { width: 45%; }
.col-qty { width: 15%; }
.col-price { width: 20%; }
.col-total { width: 15%; text-align: right; }
.col-action { width: 5%; }

.invoice-line td { padding: 5px 4px; }

.invoice-line input {
    width: 100%;
    padding: 9px 12px;
    background-color: var(--admin-input-bg);
    color: var(--admin-text);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    font-size: 0.85rem;
    transition: all 0.25s ease;
}

.invoice-line input:focus {
    outline: none;
    border-color: var(--admin-accent);
    box-shadow: 0 0 0 3px rgba(200, 155, 60, 0.1);
}

.line-total {
    text-align: right;
    font-weight: 600;
    font-size: 0.87rem;
    padding-right: 12px !important;
}

.remove-line { font-size: 1.1rem !important; }

/* ============================================================
   INVOICE SUMMARY
   ============================================================ */
.invoice-summary .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    font-size: 0.87rem;
}

.summary-total {
    font-size: 1.15rem !important;
    font-weight: 700;
    color: var(--admin-accent);
    border-top: 2px solid var(--admin-border);
    padding-top: 12px !important;
    margin-top: 6px;
}

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

.settings-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
    padding: 10px 20px;
    font-size: 0.82rem;
    font-weight: 600;
    background-color: var(--admin-card);
    color: var(--admin-text);
    border: 1px solid var(--admin-border);
    border-radius: 10px;
    cursor: pointer;
    opacity: 0.45;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.tab-btn:hover { opacity: 0.75; transform: translateY(-1px); }

.tab-btn.active {
    opacity: 1;
    background-color: var(--admin-accent);
    color: #111;
    border-color: var(--admin-accent);
    box-shadow: 0 2px 10px rgba(200, 155, 60, 0.25);
}

.tab-panel { display: none; animation: fadeUp 0.3s ease; }
.tab-panel.active { display: block; }

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 24px;
}

.setting-group { position: relative; }

.color-field {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-field input[type="color"] {
    width: 52px;
    height: 40px;
    padding: 3px;
    border: 1px solid var(--admin-border);
    border-radius: 10px;
    background-color: var(--admin-input-bg);
    cursor: pointer;
    transition: border-color 0.25s;
}

.color-field input[type="color"]:hover {
    border-color: var(--admin-accent);
}

.color-hex {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.82rem;
    opacity: 0.5;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    cursor: pointer;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background-color: var(--admin-input-bg);
    border: 1px solid var(--admin-border);
    border-radius: 28px;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    bottom: 3px;
    left: 4px;
    background-color: var(--admin-text);
    border-radius: 50%;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--admin-accent);
    border-color: var(--admin-accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
    background-color: #111;
}

.btn-reset {
    position: absolute;
    top: 0;
    right: 0;
    background: none;
    border: none;
    color: var(--admin-text);
    opacity: 0.15;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    transition: all 0.2s;
}

.btn-reset:hover {
    opacity: 0.6;
    color: var(--admin-accent);
    transform: rotate(-20deg);
}

.form-actions {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--admin-border);
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background-color: var(--admin-card);
    border-radius: 16px;
    width: 90%;
    max-width: 560px;
    max-height: 80vh;
    overflow: auto;
    border: 1px solid var(--admin-border);
    box-shadow: var(--admin-shadow-lg);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header h3 { font-size: 1rem; }

.modal-close {
    background: none;
    border: none;
    color: var(--admin-text);
    font-size: 1.4rem;
    cursor: pointer;
    opacity: 0.4;
    transition: all 0.2s;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    opacity: 1;
    background-color: var(--admin-hover);
}

.modal-body {
    padding: 22px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.6;
    opacity: 0.7;
}

/* ============================================================
   INVOICE MODAL
   ============================================================ */
.invoice-modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.invoice-modal {
    background-color: #fff;
    color: #1a1a1a;
    border-radius: 16px;
    width: 94%;
    max-width: 820px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.invoice-modal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background-color: var(--admin-sidebar);
    color: var(--admin-text);
    border-bottom: 2px solid var(--admin-accent);
}

.invoice-modal-title {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.invoice-modal-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.invoice-modal-pdf,
.invoice-modal-pdf-dl {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
}

.invoice-modal-pdf {
    background-color: var(--admin-accent);
    color: #111;
}

.invoice-modal-pdf:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(200, 155, 60, 0.3);
}

.invoice-modal-pdf-dl {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--admin-text);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.invoice-modal-pdf-dl:hover {
    border-color: var(--admin-accent);
    color: var(--admin-accent);
}

.invoice-modal-close {
    background: none;
    border: none;
    color: var(--admin-text);
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.4;
    transition: all 0.2s;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
}

.invoice-modal-close:hover {
    opacity: 1;
    background-color: rgba(255,255,255,0.06);
}

.invoice-modal-body {
    padding: 0;
    overflow: hidden;
    flex: 1;
    display: flex;
}

.invoice-modal-iframe {
    width: 100%;
    height: 100%;
    border: none;
    min-height: 70vh;
}

.invoice-modal-loading {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-style: italic;
    animation: pulse 1.5s infinite;
}

/* ============================================================
   LOGIN
   ============================================================ */
.login-body {
    background-color: var(--admin-bg);
    color: var(--admin-text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.4s ease;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background-color: var(--admin-card);
    border-radius: 18px;
    padding: 40px 34px;
    border: 1px solid var(--admin-border);
    box-shadow: var(--admin-shadow-lg);
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    max-height: 50px;
    margin: 0 auto 14px;
}

.login-title {
    font-size: 1.6rem;
    color: var(--admin-accent);
    font-weight: 700;
}

.login-subtitle {
    font-size: 0.82rem;
    opacity: 0.35;
    margin-top: 4px;
}

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

.login-footer {
    text-align: center;
    margin-top: 22px;
}

.login-footer a {
    font-size: 0.82rem;
    opacity: 0.35;
    transition: all 0.2s;
}

.login-footer a:hover {
    opacity: 0.8;
    color: var(--admin-accent);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 24px 0;
}

.pagination-link {
    padding: 7px 14px;
    font-size: 0.82rem;
    background-color: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    color: var(--admin-text);
    transition: all 0.25s ease;
}

.pagination-link:hover {
    border-color: var(--admin-accent);
    transform: translateY(-1px);
}

.pagination-link.active {
    background-color: var(--admin-accent);
    color: #111;
    border-color: var(--admin-accent);
}

.pagination-dots { padding: 7px; opacity: 0.25; }

/* ============================================================
   SIDEBAR OVERLAY MOBILE
   ============================================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 150;
    transition: opacity 0.3s;
}

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

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .burger-toggle { display: flex; }
    .form-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
    .admin-content { padding: 18px; }
    .td-actions { flex-direction: column; }
    .filters-form { flex-direction: column; }
    .settings-tabs { flex-wrap: nowrap; }
    .topbar-user-info { display: none; }
}
