/* ============================
   Global styles & design tokens
   ============================ */

:root {
    --bg-body: #020617;          /* fondo general */
    --bg-surface: #020617;       /* surface / cards */
    --bg-surface-alt: #020617;

    --border-subtle: #1f2933;
    --border-strong: #4b5563;

    --text-main: #e5e7eb;
    --text-muted: #9ca3af;
    --text-soft: #6b7280;

    --accent: #0ea5e9;           /* cyan */
    --accent-soft: rgba(14, 165, 233, 0.12);
    --accent-strong: #0284c7;

    --danger: #f97373;
    --danger-soft: rgba(248, 113, 113, 0.12);

    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, 0.12);

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --shadow-soft: 0 10px 25px rgba(0, 0, 0, 0.35);

    --font-base: system-ui, -apple-system, BlinkMacSystemFont,
                 "Segoe UI", sans-serif;

    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.5rem;
}

/* Navegadores viejos de golpe no respetan :root -> mejor asegurar body también */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: var(--font-base);
    background: radial-gradient(circle at top, #0f172a 0, #020617 55%, #000 100%);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    background-attachment: fixed;
}

/* ============================
   App shell
   ============================ */

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.app-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.app-logo {
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.9rem;
    color: #e5e7eb;
}

/* Nav */

.app-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.app-nav-left,
.app-nav-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    color: #e5e7eb;
    text-decoration: none;
    font-weight: 500;
    border: 1px solid transparent;
    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease,
        transform 0.1s ease;
}

/* Hover color */
.nav-link:hover {
    background-color: #020617;   /* slightly lighter than header */
    border-color: #1f2933;
    color: #f9fafb;
    transform: translateY(-1px);
}

/* Active section color (current page) */
.nav-link-active {
    background: linear-gradient(135deg, #2563eb, #f97316);
    color: #f9fafb;
    border-color: #1f2933;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.9),
                0 6px 14px rgba(15, 23, 42, 0.5);
}

/* Optional: divider between user and admin nav */
.nav-divider {
    width: 1px;
    height: 1.5rem;
    background: linear-gradient(to bottom, transparent, #4b5563, transparent);
    margin: 0 0.5rem;
}

.app-nav a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    transition: all 0.15s ease-out;
}

.app-nav a:hover {
    color: #e5e7eb;
    background-color: rgba(148, 163, 184, 0.15);
}

.app-nav a.active {
    color: #e5e7eb;
    background-color: var(--accent-soft);
    border: 1px solid rgba(56, 189, 248, 0.5);
}

.app-nav span {
    color: var(--text-soft);
    font-size: 0.8rem;
}

/* Layout main & footer */

.app-main {
    flex: 1;
    padding: 1.5rem 1rem 2rem;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
}

/* Footer */

.app-footer {
    font-size: 0.8rem;
    color: var(--text-soft);
    text-align: center;
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    background: rgba(15, 23, 42, 0.95);
}

/* ============================
   Typography helpers
   ============================ */

.page-title {
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin: 0 0 0.15rem;
}

.page-subtitle {
    margin: 0 0 0.85rem;
    font-size: 0.9rem;
    color: var(--text-soft);
}

/* ============================
   Cards
   ============================ */

.card {
    background: radial-gradient(circle at top left,
                rgba(148, 163, 184, 0.12),
                rgba(15, 23, 42, 0.85)),
                #020617;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: var(--shadow-soft);
    padding: 1rem 1rem 1.1rem;
    margin-bottom: 1rem;
}

.summary-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.summary-card-meta {
    font-size: 0.82rem;
    color: var(--text-soft);
}

.card-narrow {
    max-width: 620px;
    margin: 1rem auto 0;
}


/* ============================
   Buttons
   ============================ */

.btn {
    border: none;
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    transition: transform 0.08s ease-out, box-shadow 0.08s ease-out,
                background-color 0.12s ease-out, color 0.12s ease-out;
    font-weight: 500;
}

.btn-sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.78rem;
}

.btn-primary {
    background: linear-gradient(to right, var(--accent), var(--accent-strong));
    color: #0b1120;
    box-shadow: 0 8px 18px rgba(8, 47, 73, 0.7);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(8, 47, 73, 0.9);
}

.btn-secondary {
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-main);
    border: 1px solid rgba(148, 163, 184, 0.45);
}

.btn-secondary:hover {
    background: rgba(30, 41, 59, 0.95);
}

/* Por si sigues usando el inline class="btn btn-sm btn-secondary" en el logout */
button.btn,
input[type="submit"].btn {
    font-family: var(--font-base);
}

/* ============================
   Forms
   ============================ */

.form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.form-input,
.form-select,
.form-textarea {
    padding: 0.4rem 0.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    color: var(--text-main);
    font-family: var(--font-base);
    font-size: 0.9rem;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.form-textarea {
    resize: vertical;
}

/* Para inputs por defecto si tienen sólo estilos inline de antes */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
    font-family: var(--font-base);
    font-size: 0.9rem;
}

/* ============================
   Tables
   ============================ */

.table-wrapper {
    max-width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.table thead {
    background: rgba(15, 23, 42, 0.95);
}

.table th,
.table td {
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid rgba(51, 65, 85, 0.9);
    text-align: left;
    vertical-align: top;
}

.table th {
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.table tbody tr:nth-child(even) {
    background-color: rgba(15, 23, 42, 0.6);
}

.table tbody tr:hover {
    background-color: rgba(30, 64, 175, 0.15);
}

/* ============================
   Flash messages
   ============================ */

.flash {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.flash-error {
    background: var(--danger-soft);
    border: 1px solid rgba(248, 113, 113, 0.8);
    color: #fecaca;
}

.flash-success {
    background: var(--success-soft);
    border: 1px solid rgba(34, 197, 94, 0.8);
    color: #bbf7d0;
}

.flash-info {
    background: var(--accent-soft);
    border: 1px solid rgba(56, 189, 248, 0.8);
    color: #e0f2fe;
}

/* ============================
   Misc helpers
   ============================ */

.text-muted {
    color: var(--text-soft);
    font-size: 0.85rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.5);
    color: var(--text-muted);
}

/* Responsive tweaks */

@media (max-width: 768px) {
    .app-header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .app-main {
        padding: 1rem 0.75rem 1.5rem;
    }

    .card {
        padding: 0.85rem 0.8rem 0.95rem;
    }
}
