/* ── Reset y base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: #f0f2f5;
    height: 100%;
}

a { color: #1b6ec2; }

/* ── Layout principal ─────────────────────────────────────── */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

/* ── Header superior ──────────────────────────────────────── */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #1b2a3b;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    height: 52px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.app-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.logout-btn {
    font-size: 1.3rem;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.logout-btn:hover { opacity: 1; }

/* ── Contenido principal ──────────────────────────────────── */
.app-content {
    flex: 1;
    padding: 12px 12px 80px 12px; /* padding-bottom para no quedar bajo el nav */
    max-width: 640px;
    width: 100%;
    margin: 0 auto;
}

/* ── Menú inferior mobile ─────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    border-top: 1px solid #e0e4ea;
    display: flex;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
    height: 60px;
    padding-bottom: env(safe-area-inset-bottom); /* iPhone home bar */
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: #6c757d;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 6px 0;
    transition: color 0.15s, background 0.15s;
    border-radius: 0;
}

.bottom-nav-item:hover {
    color: #1b6ec2;
    background: #f5f7fa;
}

.bottom-nav-item.active {
    color: #1b6ec2;
}

.nav-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.nav-label {
    font-size: 0.68rem;
}

/* ── Botones ──────────────────────────────────────────────── */
.btn-primary {
    background-color: #1b6ec2;
    border-color: #1861ac;
    color: #fff;
}

.btn-primary:hover {
    background-color: #1861ac;
    border-color: #155a9e;
    color: #fff;
}

.btn:focus, .btn:active:focus,
.form-control:focus, .form-select:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.15rem rgba(27, 110, 194, 0.3);
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
    border-radius: 10px;
    border: 1px solid #e0e4ea;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* ── Formularios ──────────────────────────────────────────── */
.form-control, .form-select {
    border-radius: 7px;
    border: 1px solid #ced4da;
    font-size: 0.9rem;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 3px;
    color: #495057;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    font-weight: 500;
    border-radius: 5px;
}

/* ── Blazor error ─────────────────────────────────────────── */
#blazor-error-ui {
    background: #b32121;
    color: white;
    padding: 0.6rem 1rem;
    position: fixed;
    bottom: 60px;
    left: 0;
    right: 0;
    display: none;
    z-index: 9999;
    font-size: 0.85rem;
}

#blazor-error-ui .reload {
    color: #ffd;
    text-decoration: underline;
    margin-left: 0.5rem;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    float: right;
}

.blazor-error-boundary {
    padding: 1rem;
    background: #b32121;
    color: white;
    border-radius: 6px;
}

/* ── Desktop: sidebar clásico si hay espacio ──────────────── */
@media (min-width: 768px) {
    .app-container {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .app-header {
        width: 100%;
        flex-shrink: 0;
    }

    .bottom-nav {
        position: sticky;
        top: 52px;
        left: 0;
        bottom: auto;
        width: 200px;
        height: calc(100dvh - 52px);
        flex-direction: column;
        border-top: none;
        border-right: 1px solid #e0e4ea;
        box-shadow: 2px 0 6px rgba(0,0,0,0.05);
        background: #fff;
        padding-bottom: 0;
        justify-content: flex-start;
        align-items: stretch;
        gap: 4px;
        padding: 12px 8px;
    }

    .bottom-nav-item {
        flex-direction: row;
        justify-content: flex-start;
        gap: 10px;
        padding: 10px 12px;
        border-radius: 8px;
        font-size: 0.9rem;
    }

    .nav-icon { font-size: 1.1rem; }
    .nav-label { font-size: 0.9rem; }

    .app-content {
        flex: 1;
        padding-bottom: 20px;
        padding-left: 20px;
        padding-right: 20px;
    }
}

/* ── Font Awesome icon overrides ──────────────────────────── */
.bottom-nav-item .nav-icon {
    font-size: 1.2rem;
    line-height: 1;
}

@media (min-width: 768px) {
    .bottom-nav-item .nav-icon {
        font-size: 1rem;
    }
}
