/* --- ROOT VARIABLES SYSTEM --- */
:root {
    /* Shared theme tokens: charcoal, white, and gray */
    --bg-page: #0b0b0c;
    --bg-sidebar: #0e0e10;
    --bg-panel: #121214;
    --bg-panel-solid: #121214;
    
    --text-primary: #f4f4f2;
    --text-secondary: #c5c5c7;
    --text-muted: #a0a0a5;
    
    --accent: #ffffff;
    --accent-glow: rgba(255,255,255,0.10);
    --primary: #ffffff;
    --primary-hover: #d0d0d0;
    --primary-glow: rgba(255,255,255,0.10);
    
    --border-color: #303034;
    --border-hover: #48484e;
    
    /* Status Colors */
    --success: #10b981;
    --error: #D32F2F;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    /* Default Layout Dimensions */
    --sidebar-width: 240px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global resets and scrollbars */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Typography styles */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
}

/* --- BUTTONS --- */
.btn {
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer !important;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    pointer-events: auto !important;
    text-decoration: none;
}

button i, .btn i, .close-btn i, span i {
    pointer-events: none !important;
}

.btn-primary { 
    background: var(--primary); 
    color: #121212; 
    border: none;
    font-weight: 700;
}
.btn-primary:hover:not(:disabled) { 
    background: var(--primary-hover);
    color: #121212;
    transform: translateY(-1px); 
    box-shadow: 0 4px 12px rgba(255,255,255,0.18); 
}

.btn-outline { 
    background: transparent; 
    border: 1px solid var(--border-color); 
    color: var(--text-secondary);
}
.btn-outline:hover:not(:disabled) { 
    background: rgba(255,255,255,0.05); 
    color: var(--text-primary);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.btn-success {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--success);
}
.btn-success:hover {
    background: var(--success);
    color: #000;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--error);
}
.btn-danger:hover {
    background: var(--error);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-warning {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--warning);
}
.btn-warning:hover {
    background: var(--warning);
    color: black;
}

.btn:disabled { 
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* --- FORMS & INPUTS --- */
.input-group { 
    margin-bottom: 20px; 
}
.input-group label { 
    display: block; 
    font-size: 11px; 
    font-weight: 600; 
    color: var(--text-muted); 
    margin-bottom: 8px; 
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    background: #121212;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}
input:focus, select:focus, textarea:focus { 
    border-color: var(--primary); 
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: #121212;
}

input[readonly] {
    background: #121212;
    color: var(--text-muted);
    border-color: var(--border-color);
    cursor: not-allowed;
}

/* --- BADGES --- */
.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    border: 1px solid transparent;
}
.badge-pending { background: rgba(245, 158, 11, 0.1); color: var(--accent); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-completed { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }

/* --- CARDS & PANELS BASE STYLES --- */
.panel {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    transition: border-color 0.3s, box-shadow 0.3s;
}
.panel:hover {
    border-color: var(--border-hover);
}

.metric-card {
    background: #121212;
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.metric-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.25);
    box-shadow: 0 8px 24px rgba(255,255,255,0.06);
}

/* ============================================================
   SHARED TABLE BASE (SAFE SCROLLING & CLIP FIXES)
   ============================================================ */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 14px 16px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

td {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 14px;
    color: var(--text-secondary);
    vertical-align: middle;
    transition: color 0.2s;
}

tr:hover td {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.01);
}

/* Safe Scroll Wrappers: Explicitly disables backdrop blur on scroll paths to avoid browser compositing line/black cuts */
.table-container {
    background-color: var(--bg-panel-solid) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    overflow: auto;
    position: relative;
}

.table-wrap {
    overflow-x: auto;
    width: 100%;
    position: relative;
}

/* --- MODAL BASE STYLES --- */
.modal-overlay {
    display: none; 
    position: fixed; 
    inset: 0; 
    background: rgba(0, 0, 0, 0.7); 
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10000; 
    justify-content: center; 
    align-items: center;
    pointer-events: auto;
}

.modal-window {
    background-color: var(--bg-panel-solid); 
    border: 1px solid var(--border-color);
    border-radius: 20px; 
    width: 100%; 
    max-width: 480px; 
    box-shadow: 0 25px 50px rgba(0,0,0,0.5); 
    display: flex; 
    flex-direction: column; 
    overflow: hidden;
    position: relative;
    z-index: 10001;
    pointer-events: auto;
}

.modal-header {
    background: #121212;
    padding: 16px 24px;
    color: var(--text-primary);
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: 10002;
    pointer-events: auto;
}

.modal-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
    position: relative;
    z-index: 10002;
    pointer-events: auto;
}

.modal-footer {
    padding: 16px 24px;
    background: #0c0c0e;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--border-color);
    position: relative;
    z-index: 10003;
    pointer-events: auto;
}

/* --- TOAST BASE --- */
.toast-notification, #toast-notif {
    position: fixed; 
    bottom: 24px; 
    right: 24px; 
    background: #121212; 
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px); 
    border: 1px solid var(--border-color); 
    padding: 14px 20px; 
    border-radius: 12px; 
    box-shadow: 0 8px 25px rgba(0,0,0,0.4); 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    z-index: 30000; 
    transform: translateY(100px); 
    opacity: 0; 
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); 
    pointer-events: none;
}

/* --- ANIMATIONS --- */
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes modalScaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes viewSlideUp { 
    from { opacity: 0; transform: translateY(8px); } 
    to { opacity: 1; transform: translateY(0); } 
}

/* --- MIDNIGHT BREW POS: CHARCOAL / WHITE / GRAY / neutral --- */
body { background: var(--bg-page); color: var(--text-primary); }
.panel, .metric-card, .table-container, .modal-window {
    background: var(--bg-panel) !important;
    color: var(--text-primary);
    border-color: var(--border-color);
}
th { color: var(--text-muted); border-bottom-color: var(--border-color); }
td { color: var(--text-secondary); border-bottom-color: var(--border-color); }
tr:hover td { color: var(--text-primary); background: rgba(255,255,255,.025); }
input, select, textarea {
    background: #0d0d0f;
    color: var(--text-primary);
    border-color: var(--border-color);
}
input:focus, select:focus, textarea:focus { background: #0d0d0f; }
input[readonly] { background: #171719; color: var(--text-muted); }
.btn-primary { background: var(--primary); color: #15170b; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); color: #15170b; }
.btn-danger { background: rgba(255,138,145,.09); border-color: rgba(255,138,145,.28); color: #ff8a91; }
.btn-danger:hover { background: #ff525c; color: #fff; }
.modal-header, .modal-footer { background: var(--bg-panel); color: var(--text-primary); }
.toast-notification, #toast-notif { background: #19191c; color: var(--text-primary); }
.badge-pending { background: rgba(245,199,107,.10); color: #f5c76b; border-color: rgba(245,199,107,.24); }
