/* --- ROOT VARIABLES & THEMES --- */
:root {
    /* Default Dark Theme */
    --bg-dark: #0f1014;
    --bg-card: #191b21;
    --bg-sidebar: #121418;
    --text-main: #ffffff;
    --text-dim: #94a3b8;
    --border-color: #2d3139;
    --hover-bg: #2d3139;
    
    /* Fixed Colors */
    --accent-green: #00ff88;
    --accent-blue: #3b82f6;
    --danger: #ff4444;
    --success: #00ff88;
}

[data-theme="light"] {
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #f1f5f9;
    --text-main: #1e293b; 
    --text-dim: #64748b;
    --border-color: #e2e8f0;
    --hover-bg: #f1f5f9;
}

/* --- BASE STYLES --- */
* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: 'Inter', sans-serif; 
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    width: 100vw;
    overflow-x: hidden;
    overflow-y: auto; /* Restored vertical scrolling for mobile */
    transition: background-color 0.3s ease;
}

/* --- LAYOUT STRUCTURE --- */
.dashboard-wrapper { 
    display: flex; 
    min-height: 100vh;
    width: 100vw;
}

.sidebar {
    width: 240px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 1100; /* Stays above content during mobile slide-out */
}

.main-content { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    min-width: 0; 
}

.content-body {
    display: flex;
    flex: 1;
    overflow: visible; /* Allows mobile stacking to expand page height */
}

/* --- TOP NAV & BRANDING --- */
.top-nav {
    height: 70px;
    background-color: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.brand { 
    font-weight: 900; 
    font-size: 1.2rem; 
    letter-spacing: -0.5px; 
}

.brand span { 
    color: var(--accent-green); 
    font-weight: 400; 
}

.menu-hamburger {
    display: none; /* Hidden on Desktop */
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 12px; /* Large tap target for touch screens */
    z-index: 1001;
}

.menu-hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--text-main);
}

/* --- RIGHT ALERT SIDEBAR --- */
.alert-sidebar {
    width: 380px;
    background-color: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- COMPONENTS: CARDS & BUTTONS --- */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.btn-create {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.1s ease;
    margin-top: 10px;
}

.btn-create:active { 
    transform: scale(0.98); 
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--accent-green);
    font-weight: bold;
}

select {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-dark);
    color: var(--text-main);
    margin-bottom: 15px;
}

/* --- DATA TABLE --- */
.display-section {
    flex: 1;
    padding: 20px;
}

.table-container {
    background-color: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

table { 
    width: 100%; 
    border-collapse: collapse; 
}

th { 
    padding: 12px 15px; 
    text-align: left; 
    color: var(--text-dim); 
    font-size: 10px; 
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
}

td { 
    padding: 12px 15px; 
    border-bottom: 1px solid var(--border-color); 
    font-size: 13px; 
}

td.asset-cell { 
    font-weight: bold; 
    color: var(--text-main); 
}

.text-success { 
    color: var(--success) !important; 
    font-weight: bold; 
}

.text-danger { 
    color: var(--danger) !important; 
    font-weight: bold; 
}

/* --- BADGES & NAV --- */
.new-tag {
    background-color: var(--accent-green) !important;
    color: #000 !important;
    font-size: 9px;
    font-weight: 900;
    padding: 2px 5px;
    border-radius: 3px;
    margin-left: 5px;
}

.tf-badge {
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    background: rgba(128, 128, 128, 0.1);
    border: 1px solid var(--border-color);
}

.nav-item {
    padding: 14px 20px; 
    color: var(--text-dim);
    cursor: pointer;
    font-size: 13px;
    border-left: 3px solid transparent;
    transition: 0.2s ease;
}

.nav-item.active {
    background-color: rgba(0, 255, 136, 0.05);
    color: var(--accent-green);
    border-left: 3px solid var(--accent-green);
}

/* --- MOBILE RESPONSIVE LOGIC --- */

@media screen and (max-width: 1024px) {
    .menu-hamburger { 
        display: flex; 
    }
    
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        z-index: 2000; /* Highest layer for mobile drawer */
        transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }

    .sidebar.active { 
        left: 0; 
    }

    .content-body { 
        flex-direction: column; /* Stacks sidebar below signals */
    }
    
    .alert-sidebar { 
        width: 100%; 
        border-left: none; 
        border-top: 1px solid var(--border-color);
        background-color: var(--bg-dark);
    }

    .display-section {
        padding: 15px;
    }
}

@media screen and (max-width: 600px) {
    .brand { 
        font-size: 0.95rem; 
    }
    .table-container { 
        overflow-x: auto; 
    }
    table { 
        min-width: 500px; 
    }
}