/* === Reset y base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.5;
}

/* === Navbar === */
.navbar {
    background: #1a237e;
    color: white;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    height: 56px;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
}

.nav-links { display: flex; gap: 0.25rem; }

.nav-link {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background 0.15s;
}
.nav-link:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-link.active { background: rgba(255,255,255,0.15); color: white; }

/* === Layout === */
.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem 2rem; }

h1 { margin-bottom: 1rem; font-size: 1.5rem; }
h2 { margin: 1.5rem 0 0.75rem; font-size: 1.2rem; color: #555; }
h3 { margin-bottom: 0.5rem; font-size: 1rem; color: #1a237e; }

/* === Cards (dashboard) === */
.cards { display: flex; gap: 1rem; flex-wrap: wrap; }

.card {
    background: white;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    flex: 1;
    min-width: 180px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.card-danger { border-left: 4px solid #dc3545; }
.card-number { font-size: 2rem; font-weight: 700; }
.card-label { color: #777; font-size: 0.9rem; }

/* === Tabla === */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

th, td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid #eee; }
th { background: #f8f9fa; font-weight: 600; font-size: 0.85rem; color: #555; }
td { font-size: 0.9rem; }
tr:last-child td { border-bottom: none; }

/* === Badges === */
.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
}
.badge-alto { background: #dc3545; color: white; }
.badge-medio { background: #ffc107; color: #333; }
.badge-bajo { background: #28a745; color: white; }
.badge-revisada { background: #6c757d; color: white; }
.badge-pendiente { background: #ffc107; color: #333; }

/* === Botones === */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    color: #333;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s;
}
.btn:hover { background: #f0f0f0; }

.btn-primary { background: #1a237e; color: white; border-color: #1a237e; }
.btn-primary:hover { background: #283593; }

.btn-danger { background: #dc3545; color: white; border-color: #dc3545; }
.btn-danger:hover { background: #c82333; }

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

/* === Formularios === */
.form-section {
    background: white;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.form-row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; }

.form-group { margin-bottom: 0.75rem; flex: 1; min-width: 200px; }
.form-group label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 0.25rem; color: #555; }

input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: #1a237e; }

small { display: block; color: #888; font-size: 0.8rem; margin-top: 0.25rem; }

.form-inline { display: flex; gap: 1rem; align-items: flex-end; }

/* === Clases Niza grid === */
.clases-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.clase-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.clase-checkbox input { display: none; }

.clase-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 30px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.8rem;
    transition: all 0.15s;
    user-select: none;
}

.clase-checkbox input:checked + .clase-num {
    background: #1a237e;
    color: white;
    border-color: #1a237e;
}

.clase-checkbox:hover .clase-num { border-color: #1a237e; }

.checkbox-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-weight: normal !important; }

/* === Alertas y mensajes === */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

.empty-state { color: #888; padding: 2rem; text-align: center; }
.empty-state a { color: #1a237e; }

/* === Detalle alerta === */
.alerta-detalle { background: white; border-radius: 8px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

.detalle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
@media (max-width: 700px) { .detalle-grid { grid-template-columns: 1fr; } }

.detalle-seccion { margin-bottom: 1rem; }

dl { display: grid; grid-template-columns: 140px 1fr; gap: 0.25rem 0.75rem; }
dt { font-weight: 600; font-size: 0.85rem; color: #555; }
dd { font-size: 0.9rem; margin-bottom: 0.25rem; }

.detalle-acciones { display: flex; gap: 0.75rem; align-items: center; padding-top: 1rem; border-top: 1px solid #eee; }

/* === Utilidades === */
.inline-form { display: inline; }
.actions { white-space: nowrap; display: flex; gap: 0.25rem; }

/* === Navbar usuario === */
.nav-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.nav-user-name { color: rgba(255,255,255,0.85); font-size: 0.85rem; }
.nav-logout {
    background: transparent;
    color: rgba(255,255,255,0.7);
    border-color: rgba(255,255,255,0.3);
}
.nav-logout:hover { background: rgba(255,255,255,0.1); color: white; }

/* === Login page === */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
}
.login-card {
    background: white;
    border-radius: 12px;
    padding: 3rem 2.5rem;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
    max-width: 400px;
    width: 100%;
}
.login-title { font-size: 1.5rem; color: #1a237e; margin-bottom: 0.25rem; }
.login-subtitle { color: #777; margin-bottom: 2rem; font-size: 0.95rem; }
.btn-google {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    color: #333;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: box-shadow 0.15s, background 0.15s;
}
.btn-google:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: #f8f9fa; }

/* === Loading === */
.htmx-request .btn-primary { opacity: 0.6; pointer-events: none; }
.loading { opacity: 0.5; }
