/* ── Altumatim File Portal ── */

:root {
    --navy: #070b1a;
    --navy-light: #0f1629;
    --navy-mid: #1a2236;
    --navy-border: #252f45;
    --orange: #ff7800;
    --orange-hover: #e66d00;
    --orange-subtle: rgba(255, 120, 0, 0.1);
    --text-primary: #e2e8f0;
    --text-secondary: #90a1b9;
    --text-muted: #62748e;
    --white: #ffffff;
    --card-bg: #ffffff;
    --body-bg: #f0f2f5;
    --green: #059669;
    --red: #dc2626;
}

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

[hidden] {
    display: none !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    min-height: 100vh;
}

/* ══════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════ */

.login-body {
    background: var(--navy);
    background-image: url('https://storage.googleapis.com/altumatim-cdn/hero-img.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

#constellation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    position: relative;
    z-index: 1;
}

.login-card {
    background: rgba(255, 255, 255, 1);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 0.5rem;
}

.login-logo img {
    height: 40px;
}

.login-subtitle {
    text-align: center;
    color: #6b7280;
    margin-bottom: 1.75rem;
    font-size: 0.95rem;
}

/* ── Forms ── */

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: #374151;
}

.form-group input {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    background: var(--white);
}

.form-group input:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(255, 120, 0, 0.12);
}

/* ── Buttons ── */

.btn {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}

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

.btn-login {
    background: #45556c;
    color: var(--white);
    width: 100%;
    padding: 0.75rem;
    margin-top: 0.75rem;
    font-size: 1rem;
    border-radius: 10px;
}

.btn-login:hover {
    background: #374151;
}

.btn-primary {
    background: var(--orange);
    color: var(--white);
}

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

.btn-download {
    background: var(--orange-subtle);
    color: var(--orange);
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.btn-download:hover {
    background: var(--orange);
    color: var(--white);
}

.btn-secondary {
    background: var(--navy-mid);
    color: var(--text-primary);
    padding: 0.5rem 1.2rem;
    font-size: 0.85rem;
}

.btn-secondary:hover {
    background: var(--navy-border);
}

.btn-add-client {
    background: var(--orange);
    color: var(--white);
    padding: 0.5rem 1.2rem;
    font-size: 0.85rem;
}

.btn-add-client:hover {
    background: var(--orange-hover);
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-danger {
    background: var(--red);
    color: var(--white);
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-danger-outline {
    background: transparent;
    color: var(--red);
    border: 1px solid var(--red);
    padding: 0.45rem 1rem;
    font-size: 0.85rem;
}

.btn-danger-outline:hover {
    background: var(--red);
    color: var(--white);
}

.btn-delete {
    background: rgba(220, 38, 38, 0.08);
    color: var(--red);
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.btn-delete:hover {
    background: var(--red);
    color: var(--white);
}

.action-cell {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.inline-form {
    display: inline;
}

.modal-warning {
    color: var(--red);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.upload-btn-wrapper {
    text-align: center;
    margin: 1.25rem 0;
}

.btn-upload {
    padding: 0.65rem 2.5rem;
}

/* ── Flash Messages ── */

.flash-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.flash-success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #15803d;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
}

/* ══════════════════════════════════════════
   PORTAL PAGE — SIDEBAR LAYOUT
   ══════════════════════════════════════════ */

.portal-body {
    background: var(--body-bg);
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */

.sidebar {
    width: 240px;
    background: var(--navy);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
}

.sidebar-logo {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--navy-border);
}

.sidebar-logo img {
    height: 28px;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 1rem 1.25rem 0.4rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 1.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-item:hover {
    background: var(--navy-light);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--orange-subtle);
    color: var(--orange);
    border-left-color: var(--orange);
}

.nav-sub {
    padding-left: 2.5rem;
    font-size: 0.8rem;
}

.nav-sub svg {
    width: 15px;
    height: 15px;
}

.sidebar-footer {
    border-top: 1px solid var(--navy-border);
    padding: 0.75rem 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1.25rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.sidebar-user svg {
    width: 18px;
    height: 18px;
}

.sidebar-user small {
    color: var(--text-muted);
    font-weight: 400;
}

.nav-logout {
    color: var(--text-muted);
}

.nav-logout:hover {
    color: var(--red);
    background: rgba(220, 38, 38, 0.08);
}

/* ── Main Content ── */

.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 1.75rem 2rem;
}

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

/* ── Dashboard Stats ── */

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 500;
}

.stat-card-disk {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.stat-disk-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stat-btn-group {
    display: flex;
    gap: 0.35rem;
}

.disk-stats-mini {
    font-size: 0.75rem;
    color: #6b7280;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a2e;
}

@media (max-width: 900px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
}

.content-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1a1a2e;
}

/* ── Cards ── */

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

/* ── Upload Dropzone ── */

.dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: var(--card-bg);
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--orange);
    background: rgba(255, 120, 0, 0.03);
}

.dropzone-icon {
    width: 44px;
    height: 44px;
    color: #94a3b8;
    margin-bottom: 0.75rem;
}

.dropzone-text {
    font-size: 0.95rem;
    color: #475569;
}

.browse-link {
    color: var(--orange);
    font-weight: 600;
    cursor: pointer;
}

.browse-link:hover {
    text-decoration: underline;
}

.dropzone-hint {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 0.5rem;
}

/* ── Selected Files Preview ── */

.file-list-preview {
    margin: 0.75rem 1.25rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.file-preview-item {
    background: var(--orange-subtle);
    color: var(--orange-hover);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* ── Upload Progress Bar ── */

.progress-container {
    padding: 1.25rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.progress-bar-track {
    background: #e5e7eb;
    border-radius: 8px;
    height: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    background: var(--orange);
    height: 100%;
    width: 0%;
    border-radius: 8px;
    transition: width 0.3s ease;
}

.progress-bar-fill.progress-complete {
    background: var(--green);
}

.progress-bar-fill.progress-error {
    background: var(--red);
}

/* ── Disk Management Card ── */

.disk-card {
    margin-top: 1.5rem;
}

.disk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.disk-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a2e;
}

.btn-sm {
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
}

.disk-bar-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.disk-bar {
    background: #e5e7eb;
    border-radius: 6px;
    height: 10px;
    overflow: hidden;
}

.disk-bar-fill {
    background: var(--orange);
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease;
}

.disk-bar-fill.disk-warning {
    background: #eab308;
}

.disk-bar-fill.disk-critical {
    background: var(--red);
}

.disk-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #6b7280;
}

.progress-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.progress-detail {
    font-size: 0.8rem;
    color: #6b7280;
}

.progress-controls {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

/* ── Resume Banner ── */

.resume-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.resume-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #92400e;
}

.resume-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: #92400e;
}

.resume-detail {
    font-size: 0.8rem;
    color: #b45309;
    margin-top: 0.15rem;
}

.resume-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* ── Breadcrumbs ── */

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.breadcrumbs a {
    color: var(--orange);
    text-decoration: none;
    font-weight: 500;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.bc-sep {
    color: #94a3b8;
}

.bc-current {
    color: #374151;
    font-weight: 600;
}

/* ── Folder links ── */

.folder-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #1a1a2e;
    text-decoration: none;
    font-weight: 500;
}

.folder-link:hover {
    color: var(--orange);
}

.folder-icon {
    width: 18px;
    height: 18px;
    color: var(--orange);
    flex-shrink: 0;
}

.text-muted {
    color: #94a3b8;
    font-size: 0.85rem;
}

/* ── Mode Toggle ── */

.mode-toggle {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.mode-toggle-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mode-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #374151;
}

.mode-hint {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.4rem;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--orange);
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--navy-mid);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* ── File Table ── */

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

.file-table thead {
    border-bottom: 1px solid #e5e7eb;
}

.file-table th {
    text-align: left;
    padding: 0.65rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.file-table td {
    padding: 0.7rem 1rem;
    border-top: 1px solid #f1f5f9;
    font-size: 0.875rem;
    color: #374151;
}

.file-table tbody tr:hover {
    background: #f8fafc;
}

.file-name {
    font-weight: 500;
    color: #1a1a2e;
    word-break: break-all;
}

.no-files {
    text-align: center;
    color: #94a3b8;
    padding: 2rem;
}

/* ── Modal ── */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}

.modal-card {
    background: var(--white);
    border-radius: 14px;
    padding: 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.modal-card h2 {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
    color: #1a1a2e;
}

.modal-subtitle {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 1.25rem;
}

.modal-card select {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95rem;
    background: var(--white);
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.modal-actions .btn-primary {
    flex: 1;
}

.btn-cancel {
    background: #f1f5f9;
    color: #475569;
    flex: 1;
}

.btn-cancel:hover {
    background: #e2e8f0;
}

/* ── Responsive ── */

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        flex-direction: row;
        align-items: center;
        padding: 0.5rem 1rem;
        gap: 0.5rem;
    }

    .sidebar-logo {
        border-bottom: none;
        padding: 0;
    }

    .sidebar-nav {
        display: flex;
        overflow-x: auto;
        padding: 0;
    }

    .nav-section-label {
        display: none;
    }

    .nav-item {
        padding: 0.5rem 0.75rem;
        white-space: nowrap;
        border-left: none;
        border-bottom: 2px solid transparent;
    }

    .nav-item.active {
        border-left: none;
        border-bottom-color: var(--orange);
    }

    .sidebar-footer {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

    .portal-body {
        flex-direction: column;
    }

    .file-table th:nth-child(3),
    .file-table td:nth-child(3) {
        display: none;
    }
}
