/* =========================
   VARIABLES GLOBALES
========================= */
:root {
    --bg: #020617;
    --panel: rgba(255,255,255,0.04);
    --line: rgba(56,189,248,0.25);
    --accent: #38bdf8;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --error: #f87171;
    --success: #4ade80;
}

/* =========================
   RESET / BASE
========================= */
* {
    box-sizing: border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

html {
    font-size: clamp(14px, 1.2vw, 16px);
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 20%, rgba(56,189,248,0.12), transparent 40%),
        linear-gradient(180deg, var(--bg), var(--bg));
    color: var(--text);
}

/* =========================
   LAYOUT GLOBAL
========================= */
.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* =========================
   AUTH (LOGIN / REGISTER)
========================= */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: clamp(32px, 6vw, 80px) 20px;
}

.auth-panel {
    width: 420px;
    padding: 40px;
    background: var(--panel);
    border-left: 2px solid var(--accent);
    box-shadow: 0 40px 120px rgba(0,0,0,0.6);
}

.auth-panel h1 {
    margin: 0;
    letter-spacing: 0.5em;
    font-size: 28px;
}

.subtitle {
    margin: 20px 0 40px;
    font-size: 13px;
    color: var(--muted);
}

/* =========================
   FORMS
========================= */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: fade 0.4s ease;
}

label {
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--muted);
}

input,
textarea,
select {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--line);
    padding: 10px 4px;
    color: var(--text);
    font-size: 14px;
}
select {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--line);
    padding: 10px 4px;
    color: var(--text);
    font-size: 14px;
}

select option {
    background: #020617;
    color: var(--text);
}
textarea {
    min-height: 140px;
    line-height: 1.6;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
}

input.error {
    border-color: var(--error);
}

.error-msg {
    font-size: 11px;
    color: var(--error);
    margin-top: -8px;
    margin-bottom: 8px;
}

input.error,
textarea.error {
    border-bottom: 1px solid var(--error);
}

.error-msg {
    font-size: 11px;
    color: var(--error);
    margin-top: -8px;
    margin-bottom: 8px;
}


/* =========================
   BOTÓN CON PROGRESO
========================= */
.action-btn {
    position: relative;
    margin-top: 20px;
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 14px;
    letter-spacing: 0.25em;
    cursor: pointer;
    overflow: hidden;
}

.action-btn .btn-label {
    position: relative;
    z-index: 2;
}

.action-btn .btn-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: rgba(56,189,248,0.2);
    z-index: 1;
}

.action-btn .btn-result {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    z-index: 3;
}

.action-btn.loading .btn-label {
    opacity: 0;
}

.action-btn.success {
    border-color: var(--success);
    color: var(--success);
}

.action-btn.error {
    border-color: var(--error);
    color: var(--error);
}

/* =========================
   SWITCH LINKS
========================= */
.switch {
    margin-top: 24px;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
}

.switch:hover {
    color: var(--accent);
}

/* =========================
   HEADER
========================= */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
}

header .logo {
    letter-spacing: 0.4em;
    font-size: 14px;
    color: var(--text);
    text-decoration: none;
}

header nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

header nav a {
    font-size: 12px;
    color: var(--muted);
    text-decoration: none;
    letter-spacing: 0.12em;
}

header nav a:hover {
    color: var(--accent);
}

header nav .cta {
    color: var(--accent);
}

header nav .credits {
    font-size: 12px;
    color: var(--muted);
}

/* ---------- MODAL ---------- */

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.85);
    z-index: 1;
}

.modal-box {
    position: relative;
    z-index: 2;
    width: 90%;
    max-width: 420px;
    margin: 15vh auto;
    background: var(--panel);
    border-left: 2px solid var(--accent);
    padding: 32px;
    box-shadow: 0 40px 120px rgba(0,0,0,0.7);
}


/* =========================
   FOOTER
========================= */
.auth-footer {
    background: linear-gradient(
        180deg,
        rgba(2,6,23,0),
        rgba(2,6,23,0.9)
    );
    border-top: 1px solid rgba(56,189,248,0.15);
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--muted);
}

.footer-right {
    display: flex;
    gap: 16px;
}

.footer-right a {
    color: var(--muted);
    text-decoration: none;
    letter-spacing: 0.12em;
}

.footer-right a:hover {
    color: var(--accent);
}

/* =========================
   UTILIDADES
========================= */
.hidden {
    display: none;
}

.credits {
    font-size: 12px;
    color: var(--muted);
    margin-right: 16px;
}

.credits a {
    color: var(--accent);
    text-decoration: none;
    margin-left: 6px;
}

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

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

.card {
    background: rgba(255,255,255,0.03);
    border-left: 2px solid rgba(56,189,248,0.3);
    padding: 24px;
    margin-top: 24px;
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: rgba(2,6,23,0.9);
    border-left: 2px solid #38bdf8;
    padding: 16px 20px;
    color: #e5e7eb;
    font-size: 13px;
    z-index: 9999;
    animation: fade 0.3s ease;
}


/* ---------- CHAT ---------- */

.chat-wrapper {
    display: flex;
    flex-direction: column;
    height: 60vh;
    margin-top: 24px;
    border-top: 1px solid rgba(56,189,248,0.15);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Cada mensaje */
.chat-messages .empty-state {
    margin: 0;
}

/* Formulario fijo abajo */
.chat-form {
    display: flex;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(56,189,248,0.15);
}

.chat-form textarea {
    flex: 1;
    resize: none;
    min-height: 60px;
    max-height: 120px;
}

.notif-bell {
    position: relative;
    font-size: 16px;
    text-decoration: none;
}

.notif-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background: #f87171;
    border-radius: 50%;
}

.notif-dot.hidden {
    display: none;
}



/* MOBILE */
@media (max-width: 768px) {
    .chat-wrapper {
        height: 65vh;
    }

    .chat-form {
        flex-direction: column;
    }

    .chat-form button {
        width: 100%;
    }
}


/* =========================
   DASHBOARD VARIANT
========================= */

.auth-container.dashboard {
    align-items: flex-start;
}

.auth-panel.dashboard {
    width: 100%;
    max-width: 900px;
}

/* SECCIONES INTERNAS */
.panel-section {
    margin-top: 12px;
}

.panel-section h2 {
    font-size: 14px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 16px;
}

/* LISTADO VACÍO */
.empty-state {
    background: rgba(255,255,255,0.03);
    border-left: 2px solid rgba(56,189,248,0.3);
    padding: 24px;
    font-size: 14px;
    color: var(--muted);
}

/* BOTÓN SECUNDARIO */
.action-btn.secondary {
    border-color: rgba(56,189,248,0.4);
    color: var(--accent);
    margin-top: 24px;
}



@keyframes fade {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 480px) {
    .auth-panel {
        width: 100%;
        padding: 32px 24px;
    }

    .footer-inner {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}


/* =========================
   HEADER RESPONSIVE
========================= */

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    position: relative;
}

.header-left {
    display: flex;
    align-items: center;
}

.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
}

#mainNav {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ---------- MOBILE ---------- */
@media (max-width: 768px) {

    .menu-toggle {
        display: block;
    }

    #mainNav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg);
        flex-direction: column;
        align-items: flex-start;
        padding: 16px 24px;
        gap: 12px;
        border-top: 1px solid rgba(56,189,248,0.2);
        display: none;
        z-index: 999;
    }

    #mainNav.active {
        display: flex;
    }

    #mainNav a,
    #mainNav .credits {
        font-size: 13px;
        width: 100%;
    }

    #mainNav .cta {
        margin-top: 8px;
    }
}

.pagination {
    margin-top: 32px;
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 13px;
}

.pagination a {
    color: var(--accent);
    text-decoration: none;
}

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

.pagination span {
    color: var(--muted);
}


/* =========================
   SKELETON LOADER
========================= */

.skeleton {
    position: relative;
    overflow: hidden;
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255,255,255,0.06),
        transparent
    );
    animation: skeleton-shimmer 1.2s infinite;
}

.skeleton-line {
    height: 14px;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    margin-bottom: 12px;
}

.skeleton-line.long {
    width: 100%;
}

.skeleton-line.medium {
    width: 60%;
}

@keyframes skeleton-shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* =========================
   PAGE TRANSITION
========================= */

.page-transition {
    animation: pageFade .25s ease;
}

@keyframes pageFade {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* =========================
   STATUS LABELS
========================= */

.status {
    display: inline-block;
    padding: 6px 10px;
    font-size: 11px;
    letter-spacing: .12em;
    border-radius: 2px;
    margin-top: 12px;
}

.status.sent {
    color: var(--muted);
    border-left: 3px solid var(--muted);
}

.status.accepted {
    color: var(--success);
    border-left: 3px solid var(--success);
}

.status.rejected {
    color: var(--error);
    border-left: 3px solid var(--error);
}

.status.resolved {
    color: var(--accent);
    border-left: 3px solid var(--accent);
}

/* =========================
   CHAT CARD
========================= */

.chat-card {
    background: linear-gradient(
        180deg,
        rgba(255,255,255,0.06),
        rgba(255,255,255,0.03)
    );
    border-left: 3px solid var(--accent);
    padding: 26px;
    margin-bottom: 20px;
    box-shadow:
        0 12px 40px rgba(0,0,0,0.55),
        inset 0 1px 0 rgba(255,255,255,0.04);
}
