/* ===== PALETA ===== */
:root {
    --color-bg: #f0f2f5;
    --color-card-bg: #ffffff;
    --color-text: #1a1a2e;
    --color-brand: #5b6abf;
    --color-brand-dark: #1e1e2f;
    --color-success: #8dc63f;
    --color-success-dark: #5a8f2a;
    --color-danger: #e74c3c;
    --color-warning: #f39c12;
    --color-border: #e8e8f0;
    --color-th-bg: #f7f8fc;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-primary-hover: linear-gradient(135deg, #5b6abf 0%, #6a4291 100%);
}

/* ===== GLOBAL ===== */
html, body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background: var(--color-bg);
    font-size: 13px;
    color: var(--color-text);
    overflow-x: hidden;
    height: 100%;
    margin: 0;
}

a, .btn-link {
    color: var(--color-brand);
}

/* ===== BOOTSTRAP OVERRIDES ===== */
.btn-primary {
    background: var(--gradient-primary);
    border-color: var(--color-brand);
    color: #fff;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background: var(--gradient-primary-hover) !important;
    border-color: #4f5caa !important;
    color: #fff !important;
    box-shadow: 0 6px 16px rgba(102,126,234,0.35) !important;
}

.btn-success {
    background: var(--color-success);
    border-color: #78ae35;
    color: #fff;
}
.btn-success:hover,
.btn-success:focus {
    background: #78ae35 !important;
    border-color: #6a9c2f !important;
    color: #fff !important;
}

.btn-danger {
    background: var(--color-danger);
    border-color: #c0392b;
    color: #fff;
}
.btn-danger:hover,
.btn-danger:focus {
    background: #c0392b !important;
    border-color: #a93226 !important;
    color: #fff !important;
}

.btn-warning {
    background: var(--color-warning);
    border-color: #d68910;
    color: #fff;
}
.btn-warning:hover,
.btn-warning:focus {
    background: #d68910 !important;
    border-color: #b7770d !important;
    color: #fff !important;
}

.btn-excel {
    background: #1d6f42;
    border-color: #185c37;
    color: #fff;
}
.btn-excel:hover,
.btn-excel:focus {
    background: #185c37;
    border-color: #134a2c;
    color: #fff;
}

.btn-pdf {
    background: #c0392b;
    border-color: #a93226;
    color: #fff;
}
.btn-pdf:hover,
.btn-pdf:focus {
    background: #a93226;
    border-color: #922b21;
    color: #fff;
}

.btn:focus,
.btn:active:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(102,126,234,0.4);
}

/* ===== HEADINGS ===== */
h3, h4, h5 {
    color: var(--color-brand);
}

h1:focus {
    outline: none;
}

/* ===== CARDS ===== */
.card {
    border-radius: 16px !important;
    border: 1px solid var(--color-border) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06) !important;
    overflow: hidden;
}
.card-title {
    color: var(--color-brand);
}

/* ===== TABLES ===== */
.table thead th {
    background: var(--color-th-bg);
    color: var(--color-brand);
    font-weight: 600;
    font-size: 12px;
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
}
.table tbody td {
    font-size: 13px;
    border-bottom: 1px solid var(--color-bg);
    vertical-align: middle;
}

/* ===== BADGES ===== */
.badge-active,
.badge-inactive,
.badge-pending {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.badge-active {
    background: rgba(141,198,63,0.15);
    color: var(--color-success-dark);
}
.badge-inactive {
    background: #e0e0e0;
    color: #666;
}
.badge-pending {
    background: rgba(243,156,18,0.15);
    color: #b87d1a;
}

/* ===== KPI / ACCESOS DIRECTOS ===== */
.kpi-card {
    background: var(--color-card-bg);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--color-border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: 20px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102,126,234,0.2);
    color: inherit;
}
.kpi-card .kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--gradient-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
}
.kpi-card .kpi-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-brand);
    line-height: 1.1;
}
.kpi-card .kpi-label {
    font-size: 13px;
    color: #888;
}

/* ===== CONTENT AREA ===== */
.content {
    padding-top: 1rem;
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}
.page-header h3 {
    margin: 0;
    color: var(--color-brand);
}

/* ===== FILTROS ===== */
.filtros {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}
.filtros .form-control,
.filtros .form-select {
    max-width: 260px;
}

/* ===== PAGINACIÓN ===== */
.paginacion {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-top: 1px solid var(--color-border);
    background: var(--color-th-bg);
    font-size: 12px;
    color: #777;
}

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 1050;
    justify-content: center;
    align-items: center;
}
.modal-overlay.show {
    display: flex;
}
.modal-dialog-custom {
    background: var(--color-card-bg);
    border-radius: 20px;
    padding: 28px;
    width: 540px;
    max-width: 94%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: modalFadeIn 0.2s ease;
}
.modal-dialog-custom.modal-xl-custom {
    width: 960px;
}
@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}
.modal-dialog-custom h5 {
    color: var(--color-brand);
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
}

/* ===== FORMULARIO DE REGISTRO ===== */
.form-seccion {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-brand);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 4px;
    margin: 6px 0 2px;
}
.campo-candidato {
    background: rgba(102,126,234,0.06);
    border: 1px dashed rgba(102,126,234,0.45);
    border-radius: 12px;
    padding: 12px 14px;
}
.campo-candidato label {
    color: var(--color-brand);
    letter-spacing: 0.5px;
}
.contador {
    font-size: 11px;
    color: #999;
}

/* ===== ICONOS PLANOS (sin fondo/borde de botón) ===== */
.btn-icon-plain {
    background: none;
    border: none;
    padding: 5px 7px;
    border-radius: 6px;
    color: #777;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}
.btn-icon-plain:hover {
    background: var(--color-bg);
    color: var(--color-brand);
}
.btn-icon-plain:disabled {
    color: #ccc;
    cursor: not-allowed;
}
.btn-icon-plain:disabled:hover {
    background: none;
}
.btn-icon-plain.text-danger:hover {
    background: rgba(231,76,60,0.1);
    color: #c0392b !important;
}
.btn-icon-plain.text-success:hover {
    background: rgba(141,198,63,0.15);
    color: var(--color-success-dark) !important;
}
.table .btn-icon-plain + .btn-icon-plain {
    margin-left: 2px;
}

/* ===== ALERTS ===== */
.alert-success {
    background: rgba(141,198,63,0.12);
    border-color: rgba(141,198,63,0.4);
    color: #3d6b1a;
}

/* ===== LOGIN ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    padding: 1rem;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    padding: 35px 30px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-brand {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-brand);
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}
.login-brand span {
    color: var(--color-success);
}

.login-subtitle {
    color: #888;
    font-size: 14px;
    margin-bottom: 28px;
}

.login-form .form-label {
    text-align: left;
    display: block;
    font-weight: 600;
    color: #444;
    font-size: 13px;
}

.login-form .form-control {
    font-size: 14px;
    border: 1px solid #ddd;
    transition: border-color 0.2s;
}

.login-form .form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102,126,234,0.15);
}

.login-form .input-group-text {
    background: var(--color-th-bg);
    border-color: #ddd;
    border-radius: 10px 0 0 10px;
}

.login-form .input-group .btn-outline-secondary {
    border-color: #ddd;
    border-radius: 0 10px 10px 0;
    color: #888;
}

.login-form .btn-primary {
    border-radius: 10px !important;
    font-size: 15px;
    font-weight: 600;
    padding: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-form .btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102,126,234,0.4) !important;
}

.login-footer {
    color: #aaa;
    font-size: 12px;
    margin-top: 20px;
}

/* ===== VALIDATION ===== */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--color-success);
}

.invalid {
    outline: 1px solid var(--color-danger);
}

.validation-message {
    color: var(--color-danger);
    font-size: 12px;
}

/* ===== BLAZOR ===== */
.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 1.5rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "Ocurrió un error."
}

#components-reconnect-modal {
    z-index: 2000;
}
