@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400..800&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* Neo-Brutalism Palette */
    --bg: #F4F0EB; /* Off-white / Cream */
    --panel-bg: #FFFFFF;
    
    --text-main: #000000;
    --text-muted: #333333;
    
    --primary: #FDBA74; /* Peach/Orange */
    --primary-hover: #FB923C;
    
    --secondary: #93C5FD; /* Light Blue */
    --accent: #F9A8D4; /* Pink */
    
    --danger: #FCA5A5; /* Light Red */
    --success: #86EFAC; /* Light Green */

    --border-color: #000000;
    --border-width: 3px;
    
    --shadow-color: #000000;
    --shadow-offset: 6px;
    --shadow: var(--shadow-offset) var(--shadow-offset) 0px var(--shadow-color);
    --shadow-hover: 8px 8px 0px var(--shadow-color);
    
    --font-heading: 'Bricolage Grotesque', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --radius: 0px; /* Sharp corners */
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    /* Brutalist grid background */
    background-image: linear-gradient(var(--border-color) 1px, transparent 1px),
                      linear-gradient(90deg, var(--border-color) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: -1px -1px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-main);
    text-transform: uppercase;
    font-weight: 800;
}
h1 { font-size: 48px; letter-spacing: -0.04em; margin-bottom: 12px; line-height: 1.1; }
h2 { font-size: 32px; letter-spacing: -0.03em; margin-bottom: 8px; }
h3 { font-size: 24px; letter-spacing: -0.02em; margin-bottom: 8px; }
p { font-size: 16px; color: var(--text-muted); margin-bottom: 24px; font-weight: 500;}
.text-muted { color: var(--text-muted); font-size: 14px; font-weight: 600;}

/* General Layout */
.page-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 96px 24px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    z-index: 1;
}

/* Glass-panel replaced with Brutal-panel */
.glass-panel {
    background: var(--panel-bg);
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 20px;
    width: 100%;
    text-align: left;
}
label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 8px;
    color: var(--text-main);
}
input[type="text"], input[type="password"], input[type="number"] {
    width: 100%;
    padding: 12px 16px;
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    background: var(--panel-bg);
    color: var(--text-main);
    transition: all 0.2s ease;
    outline: none;
    box-shadow: 2px 2px 0px var(--border-color);
}
input:focus {
    background: #FFFBEB;
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0px var(--border-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    border: var(--border-width) solid var(--border-color);
    background: var(--panel-bg);
    color: var(--text-main);
    box-shadow: var(--shadow);
    transition: all 0.15s ease;
    font-family: var(--font-body);
}
.btn:hover:not(:disabled) { 
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-hover);
}
.btn:active:not(:disabled) {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px var(--border-color);
}
.btn:disabled { 
    opacity: 0.6; 
    cursor: not-allowed; 
    box-shadow: none;
    transform: none;
}

.btn-primary { 
    background: var(--primary); 
}
.btn-danger { 
    background: var(--danger); 
}

/* Sidebar (Admin) */
.sidebar {
    width: 260px;
    background: var(--secondary);
    border-right: var(--border-width) solid var(--border-color);
    height: 100vh;
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    z-index: 50;
    position: fixed; /* Fixed for slide-out effect */
    top: 0;
    left: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-logo {
    padding: 0 24px 24px 24px;
    margin-bottom: 12px;
    border-bottom: var(--border-width) solid var(--border-color);
    background: var(--secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sidebar-logo h2 { margin: 0; font-size: 24px; }
.sidebar-logo p { margin: 0; font-size: 14px; font-weight: 600; color: #000; }
.sidebar-close {
    display: none;
    cursor: pointer;
    background: var(--panel-bg);
    border: 2px solid var(--border-color);
    padding: 4px;
    box-shadow: 2px 2px 0px var(--border-color);
}
.sidebar-close:active {
    transform: translate(2px, 2px);
    box-shadow: none;
}

/* Mobile header/overlay removed for bottom nav */

.sidebar-logo h2 { margin: 0; font-size: 24px; }
.sidebar-logo p { margin: 0; font-size: 14px; font-weight: 600; color: #000; }

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    color: var(--text-main);
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: var(--border-width) solid var(--border-color);
    background: var(--secondary);
}
.sidebar-item:hover, .sidebar-item.active {
    background: var(--primary);
    padding-left: 32px;
}
.sidebar-item:last-child {
    border-top: var(--border-width) solid var(--border-color);
    background: var(--danger);
}
.sidebar-item:last-child:hover {
    background: #F87171;
}

.admin-content {
    flex: 1;
    padding: 48px;
    margin-left: 260px; /* Offset for fixed sidebar */
    overflow-y: auto;
    z-index: 1;
    position: relative;
    background: var(--bg);
    min-height: 100vh;
}

/* Dropzone */
.dropzone {
    width: 100%;
    border: var(--border-width) dashed var(--border-color);
    border-radius: var(--radius);
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--panel-bg);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.dropzone:hover, .dropzone.dragover {
    background: var(--primary);
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-hover);
}
.dropzone .icon { width: 48px; height: 48px; color: var(--text-main); }

/* Tables */
.table-container {
    background: var(--panel-bg);
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
    width: 100%;
    margin-top: 16px;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    font-weight: 600;
}
th, td {
    padding: 16px;
    text-align: left;
    border-bottom: var(--border-width) solid var(--border-color);
    border-right: var(--border-width) solid var(--border-color);
}
th:last-child, td:last-child {
    border-right: none;
}
th { 
    background: var(--secondary);
    color: var(--text-main); 
    text-transform: uppercase; 
    font-size: 13px; 
    font-weight: 800;
    letter-spacing: 0.05em;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--primary); }

/* Alerts */
.alert { 
    padding: 16px; 
    border-radius: var(--radius); 
    margin-bottom: 24px; 
    font-size: 15px; 
    font-weight: 700;
    border: var(--border-width) solid var(--border-color); 
    box-shadow: 4px 4px 0px var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}
.alert-error { 
    background: var(--danger); 
    color: var(--text-main); 
}
.alert-success { 
    background: var(--success); 
    color: var(--text-main); 
}

.hidden { display: none !important; }

/* Trimmer UI */
#waveform-container {
    width: 100%;
    margin-bottom: 16px;
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--panel-bg);
    box-shadow: var(--shadow);
}

/* Checkbox */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 24px;
    text-align: left;
}
.checkbox-group input[type="checkbox"] {
    margin-top: 4px;
    width: 20px;
    height: 20px;
    border: var(--border-width) solid var(--border-color);
    appearance: none;
    background: var(--panel-bg);
    cursor: pointer;
    position: relative;
}
.checkbox-group input[type="checkbox"]:checked {
    background: var(--primary);
}
.checkbox-group input[type="checkbox"]:checked::after {
    content: '✔';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    color: var(--text-main);
    font-weight: bold;
}
.checkbox-group label { margin-bottom: 0; font-size: 15px; color: var(--text-main); font-weight: 600; line-height: 1.5; text-transform: none; }

/* Stats Admin */
.stat-card {
    background: var(--accent);
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    display: inline-block;
    min-width: 200px;
    margin-bottom: 32px;
}
.stat-card h3 { margin: 0; font-size: 48px; color: var(--text-main); font-family: var(--font-body); font-weight: 800;}
.stat-card p { margin: 0; color: var(--text-main); font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;}

/* Custom Class for File List (Replaces inline styles) */
.file-list-item {
    background: var(--panel-bg);
    border: var(--border-width) solid var(--border-color);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    box-shadow: 4px 4px 0px var(--border-color);
    transition: transform 0.15s ease;
}
.file-list-item:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px var(--border-color);
    background: #FFFBEB;
}

/* ========================================= */
/* SEARCH COMPONENT                          */
/* ========================================= */
.search-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg);
    border: 2px solid var(--border-color);
    box-shadow: 2px 2px 0px var(--border-color);
    margin-bottom: 8px;
    gap: 12px;
}
.search-result-item .result-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    font-size: 14px;
    flex: 1;
}
.search-result-item .result-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.search-result-item .btn {
    padding: 6px 12px;
    font-size: 12px;
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ========================================= */
/* COMPONENTS                                */
/* ========================================= */
@media (max-width: 768px) {
    #dashboard-step {
        flex-direction: column !important;
    }
    
    .sidebar {
        position: fixed;
        bottom: 16px; /* Floating effect */
        left: 16px;
        right: 16px;
        top: auto;
        width: auto;
        height: auto;
        flex-direction: row;
        border: var(--border-width) solid var(--border-color); /* Full border */
        padding: 0;
        z-index: 100;
        justify-content: space-between;
        background: var(--panel-bg);
        box-shadow: 6px 6px 0px var(--border-color); /* Hard neo-brutal shadow */
        transform: none; /* Reset from desktop */
    }
    
    .sidebar-logo {
        display: none;
    }
    
    .sidebar-item {
        flex: 1;
        flex-direction: column;
        justify-content: center;
        align-items: center; /* Center horizontally */
        padding: 12px 4px;
        border-bottom: none;
        border-right: var(--border-width) solid var(--border-color);
        font-size: 11px;
        font-weight: 800;
        text-align: center;
        gap: 6px;
        background: transparent;
        color: var(--text-main);
    }
    .sidebar-item:last-child {
        border-right: none;
        border-top: none;
        background: transparent; /* Reset desktop danger bg */
    }
    .sidebar-item:hover, .sidebar-item.active {
        background: var(--primary);
        padding-left: 4px; /* Reset desktop padding shift */
        transform: none; /* Disable vertical shift on mobile */
    }
    .sidebar-item:last-child:hover {
        background: var(--danger); /* Hover state for logout */
    }
    
    .mobile-hide-flex {
        display: none !important;
    }
    
    .admin-content {
        margin-left: 0;
        padding: 24px 16px;
        padding-bottom: 110px; /* Extra space for the floating bottom nav */
    }
}

@media (max-width: 480px) {
    .page-container {
        padding: 32px 16px;
    }
    
    h1 { font-size: 32px; }
    h2 { font-size: 24px; }
    
    .search-result-item {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .search-result-item .result-title {
        white-space: normal;
        text-align: center;
    }
    .search-result-item .result-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .glass-panel {
        padding: 24px 16px;
    }
    
    input[type="text"], input[type="password"], input[type="number"] {
        font-size: 16px; 
        padding: 14px 16px;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 16px;
        width: 100%;
    }
    
    #auth-step .form-group > div {
        flex-direction: column;
    }
    
    #active-file-step > div:not(.file-list-item) {
        flex-direction: column;
        text-align: center;
    }
    
    .dropzone {
        padding: 40px 16px;
    }
    
    #trimmer-ui .alert {
        flex-direction: column;
        text-align: center;
    }
    #trimmer-ui > div:last-child {
        flex-direction: column;
        align-items: stretch;
    }
    #trimmer-ui > div:last-child > div {
        flex-direction: column;
        width: 100%;
    }
    #btn-trim-play, #btn-trim-upload {
        width: 100%;
    }
}
