/* ============================================================
   House Style
   Palette: #BDEDE0  #BBDBD1  #B6B8D6  #7E78D2  #6F58C9
   Fonts:   Dosis (headings)  /  Source Sans 3 (body)
   Sidebar: Deep charcoal navy  |  Action: Cobalt blue
   ============================================================ */

:root {
    /* Original palette — used for decorative accents */
    --c1: #bdede0;          /* light mint — subtle highlights */
    --c2: #bbdbd1;          /* sage — alternate accent */
    --c3: #b6b8d6;          /* lavender — badges, tags */
    --c4: #7e78d2;          /* medium purple — secondary */
    --c5: #6f58c9;          /* deep purple — decorative */

    /* Brand action color: Cobalt Blue */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff4ff;
    --primary-hover: #1e40af;

    /* Semantic */
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --success: #16a34a;
    --success-light: #f0fdf4;

    /* Sidebar: Medium slate */
    --sidebar-bg: #475569;
    --sidebar-darker: #3e4c5e;
    --sidebar-border: rgba(255,255,255,0.12);
    --sidebar-text: rgba(255,255,255,0.82);
    --sidebar-text-hover: #ffffff;
    --sidebar-active-bg: rgba(37,99,235,0.22);

    /* Neutrals — cool slate */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Radii */
    --radius: 6px;
    --radius-lg: 10px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(15,23,42,0.06);
    --shadow: 0 1px 3px rgba(15,23,42,0.1), 0 1px 2px rgba(15,23,42,0.06);
    --shadow-md: 0 4px 8px -2px rgba(15,23,42,0.1), 0 2px 4px -2px rgba(15,23,42,0.06);
    --shadow-lg: 0 12px 28px -6px rgba(15,23,42,0.15), 0 6px 10px -4px rgba(15,23,42,0.07);
}

/* ---- Reset & Base ---- */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Source Sans 3', 'Source Sans Pro', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.55;
    font-size: 0.9375rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h2, h3, h4, h5, h6,
.sidebar-brand,
.card h2,
.upload-panel-header {
    font-family: 'Dosis', sans-serif;
}
.page-header h1,
.login-box h1 {
    font-family: 'Space Grotesk', sans-serif;
}

/* ---- Layout ---- */
.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 250px;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-darker) 100%);
    color: white;
    padding: 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar-brand {
    padding: 1.1rem 1.4rem;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-bottom: 1px solid var(--sidebar-border);
    color: white;
}
.sidebar nav {
    padding: 0.4rem 0;
    flex: 1;
    overflow-y: auto;
}
.sidebar nav a {
    display: flex;
    align-items: center;
    padding: 0.5rem 1.4rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
}
.sidebar nav a:hover {
    background: rgba(255,255,255,0.04);
    color: var(--sidebar-text-hover);
}
.sidebar nav a.active {
    background: var(--sidebar-active-bg);
    color: white;
    border-left-color: var(--primary);
}
.sidebar nav .section-label {
    padding: 1.4rem 1.4rem 0.35rem;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.45);
    font-weight: 600;
}
.sidebar-footer {
    padding: 0.9rem 1.4rem;
    border-top: 1px solid var(--sidebar-border);
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
    line-height: 1.5;
}

/* Main content — light gray so white cards pop */
.main-content {
    flex: 1;
    padding: 1.75rem 2.25rem;
    background: var(--gray-50);
    min-width: 0;
}

/* ---- Page header ---- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.page-header h1 {
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: var(--gray-900);
}

/* ---- Cards ---- */
.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}
.card h2 {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.75rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--gray-200);
    color: var(--gray-900);
    letter-spacing: 0.01em;
}

/* ---- Tables (condensed) ---- */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}
th, td {
    padding: 0.35rem 0.65rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}
th {
    font-weight: 600;
    color: white;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--gray-700);
    padding: 0.45rem 0.65rem;
}
th:first-child { border-radius: var(--radius) 0 0 0; }
th:last-child { border-radius: 0 var(--radius) 0 0; }
tbody tr { transition: background 0.1s ease; }
tbody tr:nth-child(even) { background: var(--gray-50); }
tbody tr:hover { background: var(--primary-light); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.45rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.84rem;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    line-height: 1.5;
    font-family: inherit;
    transition: all 0.15s ease;
}
.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}
.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 3px 8px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}
.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-1px);
}
.btn-sm { padding: 0.2rem 0.55rem; font-size: 0.78rem; }
.btn-outline {
    background: white;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}
.btn-outline:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

/* ---- Forms ---- */
.form-group { margin-bottom: 0.9rem; }
.form-group label {
    display: block;
    font-size: 0.84rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--gray-700);
}
.form-control {
    width: 100%;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: inherit;
    background: white;
    color: var(--gray-900);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.form-inline { display: flex; gap: 0.5rem; align-items: end; flex-wrap: wrap; }
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.form-check input { width: auto; }
select.form-control { appearance: auto; }

/* ---- Alerts ---- */
.alert {
    padding: 0.65rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
}
.alert-error {
    background: var(--danger-light);
    color: var(--danger);
    border-left: 4px solid var(--danger);
}
.alert-success {
    background: var(--success-light);
    color: var(--success);
    border-left: 4px solid var(--success);
}
.alert-info {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-left: 4px solid var(--primary);
}

/* ---- Breadcrumbs ---- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.84rem;
    color: var(--gray-500);
    margin-bottom: 0.75rem;
}
.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span.sep { color: var(--gray-300); }

/* ---- Folder grid ---- */
.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.65rem;
    margin-bottom: 1.25rem;
}
.folder-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--gray-800);
    background: rgba(255,255,255,0.65);
    backdrop-filter: blur(8px);
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.5);
}
.folder-item:hover {
    border-color: var(--primary);
    background: rgba(255,255,255,0.85);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    color: var(--primary);
}
.folder-item .folder-icon {
    display: flex;
    align-items: center;
    color: var(--gray-500);
}
.folder-item:hover .folder-icon {
    color: var(--primary);
}

/* ---- Login page ---- */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--sidebar-darker) 0%, var(--sidebar-bg) 50%, var(--gray-700) 100%);
}
.login-box {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(15,23,42,0.4);
    width: 100%;
    max-width: 400px;
}
.login-box h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 1.75rem;
    text-align: center;
    color: var(--gray-900);
    letter-spacing: 0.01em;
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.75rem;
    justify-content: center;
}
.pagination a, .pagination span {
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.84rem;
    color: var(--gray-700);
    font-weight: 500;
    transition: all 0.15s ease;
}
.pagination a:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}
.pagination span.current {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ---- Badge ---- */
.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 99px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.badge-admin { background: var(--c3); color: var(--gray-800); }
.badge-action { background: var(--gray-100); color: var(--gray-600); }

/* ---- Filename (monospaced) ---- */
.filename {
    font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: -0.01em;
    color: var(--gray-800);
}

/* ---- Utilities ---- */
.text-muted { color: var(--gray-500); font-size: 0.84rem; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.flex-gap { display: flex; gap: 0.5rem; align-items: center; }

.inline-form {
    display: inline;
}

/* ---- Drop zone overlay ---- */
#drop-zone {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(37, 99, 235, 0.06);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
}
.drop-zone-inner {
    text-align: center;
    padding: 3rem 4rem;
    border: 3px dashed var(--primary);
    border-radius: var(--radius-lg);
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-lg);
}
.drop-zone-inner p {
    margin-top: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Dosis', sans-serif;
}

/* ---- Upload progress panel ---- */
#upload-panel {
    display: none;
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1001;
    width: 350px;
    max-height: 380px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.upload-panel-header {
    padding: 0.6rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    color: var(--gray-900);
}
.upload-item {
    padding: 0.45rem 1rem;
    border-bottom: 1px solid var(--gray-100);
}
.upload-name {
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
    color: var(--gray-700);
}
.upload-bar {
    height: 4px;
    background: var(--gray-200);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.15rem;
}
.upload-fill {
    height: 100%;
    width: 0;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.15s ease;
}
.upload-fill.done { background: var(--success); }
.upload-fill.err { background: var(--danger); width: 100%; }
.upload-status {
    font-size: 0.68rem;
    color: var(--gray-500);
    font-weight: 500;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { padding: 1rem; }
    .folder-grid { grid-template-columns: 1fr; }
}
