/* ═══════════════════════════════════════════════════════
   REPO — Hoja de estilos principal
   ═══════════════════════════════════════════════════════ */

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

:root {
    --bg:       #0e0f11;
    --surface:  #16181c;
    --border:   #252830;
    --accent:   #e85d26;
    --accent2:  #f5a623;
    --accent3:  #ffffff;
    --text:     #e85d26;
    --muted:    #ffffff;
    --muted2:   #e85d26;
    --success:  #22c55e;
    --danger:   #ef4444;
    --mono:     'Space Mono', monospace;
    --sans:     'Syne', sans-serif;
    --radius:   6px;
    --sidebar:  240px;
    --topbar-h: 56px;
}

html, body { height: 100%; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 15px;
    display: flex;
}

/* ── FONDO REJILLA ───────────────────────────────────── */
body.grid-bg::before {
    content: '';
    position: fixed; inset: 0;
    background-image:
        linear-gradient(rgba(232,93,38,.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(232,93,38,.04) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
    z-index: 0;
}

/* ── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar);
    min-height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    transition: transform .25s ease;
}
.sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-logo img.logo-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}
.sidebar-logo .logo-text { min-width: 0; }
.sidebar-logo .logo-mark {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--accent);
    letter-spacing: .15em;
    text-transform: uppercase;
    margin-bottom: 1px;
}
.sidebar-logo h1 { font-size: 20px; font-weight: 800; letter-spacing: -.5px; }

.sidebar-nav { flex: 1; padding: 14px 0; overflow-y: auto; }
.nav-section { padding: 0 14px; margin-bottom: 2px; }
.nav-label {
    font-family: var(--mono);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted2);
    padding: 10px 8px 5px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius);
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all .15s;
    position: relative;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.04); }
.nav-item.active { color: var(--accent); background: rgba(232,93,38,.1); }
.nav-item.active::before {
    content: '';
    position: absolute;
    left: -14px; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 20px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
}
.nav-icon { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0;color:var(--muted); }

.sidebar-footer { padding: 14px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; color: #fff;
    flex-shrink: 0;
}
.user-info { overflow: hidden; }
.user-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-family: var(--mono); font-size: 10px; color: var(--accent3); letter-spacing: .05em; }

.btn-logout {
    width: 100%; padding: 8px;
    background: rgba(239,68,68,.1);
    border: 1px solid rgba(239,68,68,.25);
    border-radius: var(--radius);
    color: #ffff;
    font-family: var(--text); font-size: 13px; letter-spacing: .05em;
    cursor: pointer; transition: all .15s;
}
.btn-logout:hover { background: rgba(239,68,68,.2); }

/* ── OVERLAY MÓVIL ───────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 190;
}

/* ── TOPBAR MÓVIL ────────────────────────────────────── */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 150;
}
.mobile-logo { font-size: 20px; font-weight: 800; letter-spacing: -.5px; }
.mobile-logo img { height: 28px; width: auto; object-fit: contain; vertical-align: middle; }
.hamburger {
    background: none; border: none; cursor: pointer;
    padding: 6px; display: flex; flex-direction: column; gap: 5px;
}
.hamburger span {
    display: block; width: 22px; height: 2px;
    background: var(--text); border-radius: 2px; transition: all .2s;
}

/* ── MAIN ────────────────────────────────────────────── */
.main {
    margin-left: var(--sidebar);
    flex: 1; min-height: 100vh;
    display: flex; flex-direction: column;
}
.topbar {
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
}
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.page-subtitle { font-size: 13px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }
.content { padding: 28px 32px; flex: 1; }

/* ── CARD ────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
}

/* ── BOTONES ─────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px; border-radius: var(--radius);
    font-family: var(--sans); font-size: 13px; font-weight: 700;
    cursor: pointer; border: none; text-decoration: none;
    transition: all .15s; white-space: nowrap;
}
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #d44f1e; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #2e3240; }
.btn-danger    { background: rgba(239,68,68,.15); color: #ef4444; border: 1px solid rgba(239,68,68,.3); }
.btn-danger:hover { background: rgba(239,68,68,.25); }
.btn-ghost     { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,.05); }
.btn-sm        { padding: 5px 11px; font-size: 12px; }
.btn-icon      { padding: 6px 8px; }

/* ── FORMULARIOS ─────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-family: var(--mono); font-size: 11px;
    letter-spacing: .08em; text-transform: uppercase;
    color: var(--muted); margin-bottom: 6px;
}
.form-control {
    width: 100%; padding: 9px 12px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text);
    font-family: var(--sans); font-size: 14px;
    transition: border-color .15s; outline: none;
}
.form-control:focus { border-color: var(--accent); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ── TABLAS ──────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; min-width: 480px; }
.table th {
    font-family: var(--mono); font-size: 10px;
    letter-spacing: .1em; text-transform: uppercase;
    color: var(--muted); padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left; white-space: nowrap;
}
.table td {
    padding: 13px 14px;
    border-bottom: 1px solid rgba(37,40,48,.6);
    font-size: 14px; vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255,255,255,.02); }

/* ── BADGES ──────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 8px; border-radius: 20px;
    font-family: var(--mono); font-size: 10px;
    letter-spacing: .05em; font-weight: 700;
}
.badge-accent  { background: rgba(232,93,38,.15); color: var(--accent); }
.badge-success { background: rgba(34,197,94,.15);  color: #22c55e; }
.badge-muted   { background: rgba(107,114,128,.15); color: var(--muted); }

/* ── ALERTAS ─────────────────────────────────────────── */
.alert {
    padding: 12px 16px; border-radius: var(--radius);
    font-size: 14px; margin-bottom: 20px;
    display: flex; align-items: center; gap: 8px;
}
.alert-success { background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.25); color: #4ade80; }
.alert-error   { background: rgba(239,68,68,.1);  border: 1px solid rgba(239,68,68,.25);  color: #f87171; }

/* ── ESTADO VACÍO ────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .icon { font-size: 40px; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 14px; }

/* ── UTILIDADES ──────────────────────────────────────── */
.color-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.text-muted { color: var(--muted); font-size: 13px; }
.text-mono  { font-family: var(--mono); }

/* ── MODAL GENÉRICO ──────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.75);
    z-index: 1000;
    align-items: center; justify-content: center;
    padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px; padding: 28px;
    width: 100%; max-width: 480px;
    position: relative;
    max-height: 90vh; overflow-y: auto;
}
.modal-title { font-size: 18px; font-weight: 800; margin-bottom: 20px; }
.modal-close {
    position: absolute; top: 16px; right: 16px;
    background: none; border: none;
    color: var(--muted); font-size: 20px;
    cursor: pointer; line-height: 1;
}
.modal-close:hover { color: var(--text); }

/* ── MODAL CONFIRMACIÓN BORRADO ──────────────────────── */
.modal-confirm .modal-icon {
    font-size: 36px;
    text-align: center;
    margin-bottom: 12px;
}
.modal-confirm .modal-title {
    text-align: center;
    font-size: 17px;
    margin-bottom: 8px;
}
.modal-confirm .modal-msg {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 24px;
    line-height: 1.5;
}
.modal-confirm .modal-actions {
    display: flex; gap: 10px;
}
.modal-confirm .modal-actions .btn { flex: 1; justify-content: center; }

/* ── TOAST ───────────────────────────────────────────── */
.toast {
    position: fixed; bottom: 24px; right: 24px;
    background: var(--surface); border: 1px solid var(--border);
    padding: 12px 18px; border-radius: 8px;
    font-size: 13px; font-weight: 600;
    display: none; z-index: 9999;
    box-shadow: 0 8px 32px rgba(0,0,0,.4);
    transition: opacity .2s;
}

/* ── LOGIN ───────────────────────────────────────────── */
body.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}
.login-wrap { position: relative; width: 100%; max-width: 400px; padding: 20px; }
.login-header { text-align: center; margin-bottom: 36px; }
.login-logo-img { width: 72px; height: 72px; object-fit: contain; margin-bottom: 10px; }
.login-logo-mark {
    font-family: var(--mono); font-size: 11px;
    color: var(--accent); letter-spacing: .2em; text-transform: uppercase;
}
.login-logo-main { font-size: 52px; font-weight: 800; letter-spacing: -2px; line-height: 1; margin: 4px 0 8px; }
.login-logo-sub { font-size: 13px; color: var(--muted); font-family: var(--mono); }
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px; padding: 32px;
}
.btn-login {
    width: 100%; padding: 12px;
    background: var(--accent); color: #fff;
    border: none; border-radius: 6px;
    font-family: var(--sans); font-size: 15px; font-weight: 700;
    cursor: pointer; transition: background .15s; margin-top: 6px;
}
.btn-login:hover { background: #d44f1e; }
.login-hint {
    text-align: center; margin-top: 18px;
    font-family: var(--mono); font-size: 11px; color: var(--muted);
}
.login-hint span { color: var(--accent); }

/* ── SHARE PAGE ──────────────────────────────────────── */
body.share-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}
.share-wrap { width: 100%; max-width: 480px; position: relative; }
.share-badge { text-align: center; margin-bottom: 28px; }
.share-badge span { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .1em; }
.share-badge strong { font-size: 20px; font-weight: 800; letter-spacing: -1px; display: block; margin-top: 2px; }
.share-badge img { height: 36px; width: auto; object-fit: contain; margin-bottom: 6px; }
.file-icon-big { font-size: 48px; margin-bottom: 16px; text-align: center; }
.file-concept { font-size: 22px; font-weight: 800; letter-spacing: -.5px; margin-bottom: 6px; text-align: center; }
.file-orig { font-family: var(--mono); font-size: 11px; color: var(--muted); text-align: center; margin-bottom: 24px; word-break: break-all; }
.meta-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.meta-row:last-of-type { border-bottom: none; }
.meta-label { color: var(--muted); font-family: var(--mono); font-size: 11px; letter-spacing: .05em; }
.meta-value { font-weight: 600; }
.btn-download {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 14px;
    background: var(--accent); color: #fff;
    border: none; border-radius: 8px;
    font-family: var(--sans); font-size: 15px; font-weight: 700;
    text-decoration: none; cursor: pointer;
    margin-top: 24px; transition: background .15s;
}
.btn-download:hover { background: #d44f1e; }
.share-footer { text-align: center; margin-top: 16px; font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 768px) {
    body { display: block; }

    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: 4px 0 32px rgba(0,0,0,.6); }
    .sidebar-overlay.open { display: block; }

    .mobile-topbar { display: flex; }
    .main { margin-left: 0; padding-top: var(--topbar-h); }

    .topbar { padding: 14px 16px; }
    .page-title { font-size: 20px; }
    .content { padding: 14px; }

    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .card { padding: 14px; }
    .modal { padding: 20px 16px; }
    .hide-mobile { display: none !important; }

    body.login-body { display: flex; }
    body.share-body { display: flex; }
}
@media (max-width: 480px) {
    .page-title { font-size: 18px; }
    .content { padding: 10px; }
    .topbar { padding: 10px 12px; }
}
