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

:root {
    --bg: #0a0a0f;
    --surface: #13131f;
    --surface2: #1a1a2e;
    --border: #252540;
    --text: #e0e0f0;
    --text-dim: #8888aa;
    --primary: #6c5ce7;
    --primary-hover: #7d6ff0;
    --primary-glow: rgba(108, 92, 231, 0.3);
    --danger: #e74c3c;
    --success: #00cec9;
    --warning: #fdcb6e;
    --radius: 12px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ========== LOGIN PAGE ========== */
.container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0a0f 70%);
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow), 0 0 60px var(--primary-glow);
    text-align: center;
}

.logo {
    color: var(--primary);
    margin-bottom: 16px;
    display: inline-block;
}

.login-card h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 32px;
}

.info-text {
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 16px;
    text-align: center;
}

/* ========== FORMULARIOS ========== */
.form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group {
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 6px;
    font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="file"] {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.input {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 15px;
    outline: none;
}

.input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ========== BOTONES ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 16px var(--primary-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
}

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

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

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

.btn-link {
    background: none;
    color: var(--text-dim);
    padding: 8px;
    font-size: 13px;
}

.btn-link:hover { color: var(--text); }

.btn-small {
    padding: 6px 14px;
    font-size: 13px;
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
}

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

.btn-block {
    width: 100%;
    margin-bottom: 8px;
}

.btn-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ========== MENSAJES ========== */
.error-message {
    color: var(--danger);
    font-size: 13px;
    padding: 8px 12px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(231, 76, 60, 0.2);
}

/* ========== APP LAYOUT (app.html) ========== */
body.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.app-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.breadcrumb {
    display: flex;
    gap: 4px;
    font-size: 13px;
    color: var(--text-dim);
}

.breadcrumb span {
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: 0.15s;
}

.breadcrumb span:hover { color: var(--text); background: var(--surface2); }
.breadcrumb .sep { color: var(--border); cursor: default; }
.breadcrumb .sep:hover { background: none; color: var(--border); }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-badge {
    font-size: 13px;
    color: var(--text-dim);
    padding: 4px 10px;
    background: var(--surface2);
    border-radius: 20px;
}

.main-area {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ========== SIDEBAR ========== */
.sidebar {
    width: 240px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex-shrink: 0;
}

.sidebar-section h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 10px;
}

.status-text {
    font-size: 12px;
    color: var(--text-dim);
}

.upload-progress {
    margin-top: 8px;
}

.progress-bar {
    height: 6px;
    background: var(--surface2);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s;
}

.progress-text {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 4px;
}

/* ========== AREA DE ARCHIVOS ========== */
.files-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.files-header {
    display: grid;
    grid-template-columns: 1fr 120px 180px 50px;
    gap: 12px;
    padding: 12px 24px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.files-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.files-list .loading {
    text-align: center;
    padding: 48px;
    color: var(--text-dim);
}

/* ========== FILA DE ARCHIVO ========== */
.file-row {
    display: grid;
    grid-template-columns: 1fr 120px 180px 50px;
    gap: 12px;
    padding: 10px 24px;
    align-items: center;
    transition: background 0.1s;
    cursor: pointer;
    border-bottom: 1px solid transparent;
}

.file-row:hover { background: var(--surface2); }

.file-row .file-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.file-row .file-icon {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.file-row .file-size {
    font-size: 13px;
    color: var(--text-dim);
}

.file-row .file-date {
    font-size: 13px;
    color: var(--text-dim);
}

.file-row .file-actions {
    display: flex;
    flex-direction: row;
    gap: 4px;
    justify-content: flex-end;
    align-items: center;
}

.file-row .btn-action {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: 0.15s;
}

.file-row .btn-action:hover { color: var(--danger); background: rgba(231,76,60,0.1); }

/* ========== MODAL ========== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    min-width: 320px;
    max-width: 400px;
    box-shadow: var(--shadow);
}

.modal-content h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    justify-content: flex-end;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .login-card { padding: 32px 24px; }
    .sidebar { display: none; }
    .files-header, .file-row {
        grid-template-columns: 1fr 80px 140px 40px;
        padding: 10px 12px;
    }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-dim);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state p { font-size: 15px; }

/* ========== LOADING OVERLAY ========== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 15, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.loading-spinner {
    text-align: center;
}
.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}
.loading-spinner p {
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
}
