/* ============================================================
   File Distribution Portal — Stylesheet
   ============================================================ */

/* ---------- RESET & BASE ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:      #2563eb;
    --primary-dark: #1d4ed8;
    --danger:       #dc2626;
    --success:      #16a34a;
    --warning:      #d97706;
    --surface:      #ffffff;
    --surface-alt:  #f8fafc;
    --border:       #e2e8f0;
    --text:         #0f172a;
    --text-muted:   #64748b;
    --sidebar-w:    240px;
    --navbar-h:     60px;
    --radius:       8px;
    --shadow:       0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:    0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--surface-alt);
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.text-muted { color: var(--text-muted); font-size: .875rem; }
.nowrap     { white-space: nowrap; }
.hidden     { display: none !important; }

/* ---------- NAVBAR ---------- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--navbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
}

.nav-icon { width: 32px; height: 32px; }

.navbar-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.navbar-name { font-size: .875rem; color: var(--text-muted); }

/* ---------- LAYOUT ---------- */
.layout {
    display: flex;
    min-height: calc(100vh - var(--navbar-h));
}

.layout-single {
    max-width: 700px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.25rem 0;
    min-height: calc(100vh - var(--navbar-h));
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem .75rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: .5rem;
}

.sidebar-header h3 {
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-muted);
}

.category-list { list-style: none; }

.category-list li a {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem 1rem;
    color: var(--text);
    border-left: 3px solid transparent;
    font-size: .9rem;
    transition: background .15s, border-color .15s;
}

.category-list li a:hover { background: var(--surface-alt); text-decoration: none; }
.category-list li a.active { background: #eff6ff; border-left-color: var(--primary); color: var(--primary); font-weight: 600; }
.cat-icon { font-size: 1rem; }
.cat-count { margin-left: auto; background: var(--border); border-radius: 999px; padding: 0 .4rem; font-size: .75rem; color: var(--text-muted); }

.empty-note { padding: .5rem 1rem; color: var(--text-muted); font-size: .85rem; font-style: italic; }

/* ---------- CONTENT ---------- */
.content {
    flex: 1;
    padding: 1.75rem 2rem;
    overflow-x: auto;
}

.content-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.content-header h2 { font-size: 1.3rem; font-weight: 700; }

/* ---------- CATEGORY GRID ---------- */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.category-card {
    display: flex;
    gap: .9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    box-shadow: var(--shadow);
    color: var(--text);
    transition: box-shadow .15s, transform .15s;
}

.category-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); text-decoration: none; }
.cat-card-icon { font-size: 2rem; line-height: 1; }
.cat-card-info h3 { font-size: 1rem; font-weight: 600; margin-bottom: .15rem; }
.cat-card-info p  { font-size: .8rem; color: var(--text-muted); margin-bottom: .4rem; }
.cat-meta { font-size: .78rem; color: var(--text-muted); }

/* ---------- FILE TABLE ---------- */
.file-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.file-table th {
    background: #f1f5f9;
    text-align: left;
    padding: .7rem 1rem;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.file-table td {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: .9rem;
}

.file-table tr:last-child td { border-bottom: none; }
.file-table tr:hover td { background: #f8fafc; }

.file-name { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.file-ext {
    font-size: .65rem;
    font-weight: 700;
    background: var(--primary);
    color: #fff;
    padding: .1rem .35rem;
    border-radius: 4px;
    letter-spacing: .05em;
    flex-shrink: 0;
}

/* ---------- BUTTONS ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .5rem 1rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: .875rem;
    cursor: pointer;
    border: none;
    text-decoration: none !important;
    transition: background .15s, box-shadow .15s;
    white-space: nowrap;
}

.btn-primary  { background: var(--primary);  color: #fff; }
.btn-primary:hover  { background: var(--primary-dark); }
.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }
.btn-danger   { background: var(--danger);   color: #fff; }
.btn-danger:hover   { background: #b91c1c; }
.btn-outline  { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover  { background: #eff6ff; }

.btn-sm   { padding: .3rem .7rem; font-size: .8rem; }
.btn-xs   { padding: .15rem .45rem; font-size: .72rem; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- FORMS ---------- */
.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.form-card h2 { margin-bottom: 1.5rem; font-size: 1.2rem; }

.form-group { margin-bottom: 1.1rem; }
.form-group label {
    display: block;
    font-weight: 600;
    font-size: .875rem;
    margin-bottom: .35rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: .55rem .75rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: .95rem;
    background: var(--surface);
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

.form-group textarea { resize: vertical; }
.form-check label { display: flex; align-items: center; gap: .5rem; font-weight: normal; }
.form-check input[type="checkbox"] { width: auto; }

.form-actions {
    display: flex;
    gap: .75rem;
    justify-content: flex-end;
    padding-top: .75rem;
    border-top: 1px solid var(--border);
    margin-top: 1.25rem;
}

/* ---------- FILE DROP ZONE ---------- */
.file-drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    background: var(--surface-alt);
    transition: border-color .15s, background .15s;
    cursor: pointer;
    position: relative;
}

.file-drop-zone:hover, .file-drop-zone.has-file {
    border-color: var(--primary);
    background: #eff6ff;
}

.file-drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.drop-zone-text span { display: block; font-weight: 600; margin-bottom: .3rem; }
.drop-zone-text small { color: var(--text-muted); font-size: .8rem; }

.file-preview {
    margin-top: .6rem;
    padding: .5rem .75rem;
    background: #dbeafe;
    border-radius: var(--radius);
    font-size: .875rem;
    color: var(--primary-dark);
    font-weight: 500;
}

/* ---------- ALERTS ---------- */
.alert {
    padding: .85rem 1.1rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: .9rem;
    font-weight: 500;
}

.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ---------- BADGES ---------- */
.badge {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.badge-0 { background: #e2e8f0; color: #475569; }
.badge-1 { background: #dbeafe; color: #1e40af; }
.badge-2 { background: #fef3c7; color: #92400e; }

/* ---------- STATUS ---------- */
.status-active   { color: var(--success); font-weight: 600; font-size: .85rem; }
.status-inactive { color: var(--danger);  font-weight: 600; font-size: .85rem; }

/* ---------- EMPTY STATE ---------- */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}
.empty-state p { margin-bottom: 1rem; }

/* ---------- TABS ---------- */
.tab-bar {
    display: flex;
    gap: .25rem;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
}
.tab {
    padding: .55rem 1.1rem;
    font-size: .9rem;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .15s;
    text-decoration: none !important;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- AUTH PAGE ---------- */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
}

.auth-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
}

.auth-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .6rem;
    margin-bottom: 2rem;
}

.auth-logo svg { width: 56px; height: 56px; }
.auth-logo h1 { font-size: 1.3rem; font-weight: 700; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 700px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; min-height: auto; border-right: none; border-bottom: 1px solid var(--border); }
    .content { padding: 1rem; }
    .file-table { font-size: .8rem; }
    .file-table th, .file-table td { padding: .5rem .6rem; }
    .category-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .category-grid { grid-template-columns: 1fr; }
    .content-header { flex-direction: column; }
}
