@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --white:       #ffffff;
    --bg:          #f0f4fa;
    --surface:     #e8eef8;
    --border:      #d4dff0;
    --navy:        #0d1b3e;
    --navy-light:  #162553;
    --navy-mid:    #1e3370;
    --cyan:        #0284c7;
    --cyan-soft:   rgba(2, 132, 199, 0.10);
    --text:        #0d1b3e;
    --text-mid:    #4a5780;
    --text-light:  #8fa0c0;
    --danger:      #dc2626;
    --success:     #16a34a;
    --warning:     #d97706;
    --radius:      12px;
    --shadow-sm:   0 1px 4px rgba(13,27,62,0.07);
    --shadow-md:   0 4px 16px rgba(13,27,62,0.10);
    --shadow-lg:   0 16px 48px rgba(13,27,62,0.14);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.02em; }

a { color: var(--cyan); text-decoration: none; }

button {
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    border: none;
    border-radius: var(--radius);
    padding: 9px 20px;
    font-weight: 600;
    font-size: 0.88rem;
    transition: all 0.18s ease;
}

input, select, textarea {
    font-family: 'Inter', sans-serif;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.9rem;
    background: var(--white);
    color: var(--text);
    width: 100%;
    transition: border 0.18s, box-shadow 0.18s;
}

input::placeholder { color: var(--text-light); }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(2,132,199,0.12);
}

select option { background: var(--white); color: var(--text); }

.btn-primary {
    background: var(--navy);
    color: var(--white);
}
.btn-primary:hover {
    background: var(--navy-mid);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--white);
    color: var(--navy);
    border: 1.5px solid var(--border);
}
.btn-secondary:hover {
    border-color: var(--navy);
    background: var(--bg);
}

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #b91c1c; }

.btn-gold { background: #f59e0b; color: var(--white); font-weight: 600; }
.btn-gold:hover { background: var(--warning); }

/* ── LOGIN ─────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg) 0%, var(--surface) 100%);
    padding: 24px;
}

.login-split {
    display: flex;
    width: 100%;
    max-width: 900px;
    min-height: 560px;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

/* Panel izquierdo — blanco, logo */
.login-panel-left {
    flex: 1.05;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
    border-right: 1px solid var(--border);
    position: relative;
}

.login-panel-left::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--navy), var(--cyan));
    display: none;
}

.login-panel-left-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    text-align: center;
}

.login-brand-logo {
    width: 230px;
    height: auto;
    object-fit: contain;
}

.login-brand-divider {
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, var(--navy), var(--cyan));
    border-radius: 2px;
}

.login-brand-tagline {
    color: var(--text-mid);
    font-size: 0.92rem;
    line-height: 1.7;
}

.login-brand-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.brand-badge {
    background: var(--bg);
    color: var(--navy);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Panel derecho — navy, formulario */
.login-panel-right {
    flex: 1;
    background: var(--navy);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 44px;
}

.login-form-wrapper {
    width: 100%;
    max-width: 320px;
}

.login-form-wrapper h1 {
    font-size: 1.75rem;
    color: var(--white);
    margin-bottom: 6px;
}

.login-subtitle {
    color: rgba(255,255,255,0.55);
    font-size: 0.85rem;
    margin-bottom: 32px;
}

.login-form-wrapper .form-group {
    margin-bottom: 18px;
}

.login-form-wrapper .form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.6);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.login-form-wrapper input {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
    color: var(--white);
}

.login-form-wrapper input::placeholder { color: rgba(255,255,255,0.3); }

.login-form-wrapper input:focus {
    border-color: var(--cyan);
    background: rgba(255,255,255,0.12);
    box-shadow: 0 0 0 3px rgba(2,132,199,0.2);
}

.login-form-wrapper .btn-primary {
    width: 100%;
    padding: 13px;
    font-size: 0.95rem;
    margin-top: 8px;
    background: var(--white);
    color: var(--navy);
    border-radius: 10px;
}
.login-form-wrapper .btn-primary:hover {
    background: var(--bg);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.login-error {
    color: #fca5a5;
    font-size: 0.82rem;
    margin-top: 12px;
    min-height: 1.4em;
    text-align: center;
}

.login-footer-text {
    color: rgba(255,255,255,0.3);
    font-size: 0.75rem;
    text-align: center;
    margin-top: 32px;
}

/* ── DASHBOARD ──────────────────────────── */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* Sidebar — blanco dominante */
.sidebar {
    width: 240px;
    background: var(--white);
    border-right: 1px solid var(--border);
    color: var(--text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header img {
    width: 148px;
    height: auto;
    object-fit: contain;
}

.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
}

.sidebar-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-light);
    margin: 0 8px 10px;
    font-weight: 600;
}

.area-btn {
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    background: transparent;
    color: var(--text-mid);
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: all 0.18s;
    border: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    border-left: 3px solid transparent;
}

.area-btn:hover {
    background: var(--bg);
    color: var(--text);
}

.area-btn.active {
    background: var(--cyan-soft);
    color: var(--navy);
    border-left-color: var(--navy);
    font-weight: 600;
}

.sidebar-footer {
    padding: 14px 12px;
    border-top: 1px solid var(--border);
}

.user-info {
    font-size: 0.78rem;
    margin-bottom: 10px;
    color: var(--text-light);
    padding: 0 4px;
}

.sidebar-footer .btn-secondary {
    width: 100%;
    font-size: 0.85rem;
    color: var(--text-mid);
    border-color: var(--border);
}

.sidebar-footer .btn-secondary:hover {
    color: var(--navy);
    border-color: var(--navy);
    background: var(--bg);
}

/* Main content */
.main-content {
    flex: 1;
    padding: 28px 32px;
    overflow-y: auto;
    background: var(--bg);
}

/* Top bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    background: var(--white);
    padding: 16px 22px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    border-left: 4px solid var(--navy);
}

.top-bar h1 {
    font-size: 1.3rem;
    color: var(--navy);
}

.top-bar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Summary cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    border-top: 3px solid var(--navy);
}

.summary-card:nth-child(2) { border-top-color: var(--cyan); }
.summary-card:nth-child(3) { border-top-color: var(--danger); }

.summary-card .label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 8px;
}

.summary-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.03em;
    line-height: 1;
}

.summary-card .value.alert { color: var(--danger); }

/* Table */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 12px;
}

.search-box {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
    max-width: 360px;
}

.search-box input { flex: 1; }

.table-wrapper {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    border: 1px solid var(--border);
}

table { width: 100%; border-collapse: collapse; }

thead th {
    background: var(--navy);
    color: var(--white);
    padding: 13px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

tbody tr:nth-child(even) { background: var(--bg); }
tbody tr:hover { background: var(--cyan-soft); }

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.87rem;
    color: var(--text);
}

tbody tr:last-child td { border-bottom: none; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-bueno   { background: #dcfce7; color: #15803d; }
.badge-regular { background: #fef9c3; color: #92400e; }
.badge-danado, .badge-dañado { background: #fee2e2; color: #991b1b; }

.row-actions { display: flex; gap: 6px; }
.row-actions button { padding: 5px 11px; font-size: 0.77rem; }

/* MODAL */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(13,27,62,0.45);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--white);
    border-radius: 18px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    border-top: 4px solid var(--navy);
}

.modal h2 {
    font-size: 1.2rem;
    margin-bottom: 22px;
    color: var(--navy);
}

.modal .form-group { margin-bottom: 15px; }

.modal .form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-mid);
    margin-bottom: 6px;
}

.modal .form-row { display: flex; gap: 12px; }
.modal .form-row .form-group { flex: 1; }

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

/* Loading */
.loading {
    text-align: center;
    padding: 48px;
    color: var(--text-light);
    font-size: 0.88rem;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2.5px solid var(--border);
    border-top-color: var(--navy);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── RESPONSIVE ─────────────────────────── */
@media (max-width: 768px) {
    .login-split {
        flex-direction: column;
        min-height: auto;
        border-radius: 18px;
    }

    .login-panel-left { padding: 32px 24px; border-right: none; border-bottom: 1px solid var(--border); }
    .login-brand-logo { width: 180px; }
    .login-panel-right { padding: 32px 24px; }

    .dashboard { flex-direction: column; }
    .sidebar { width: 100%; }
    .sidebar-nav { padding: 12px; }
    .main-content { padding: 16px; }

    .top-bar { flex-direction: column; align-items: flex-start; gap: 12px; }
    .summary-cards { grid-template-columns: repeat(2, 1fr); }
    .table-controls { flex-direction: column; align-items: stretch; }
    .search-box { max-width: none; }
}
