/* ==========================================================================
   PORTAL DE PADRÓN - SISTEMA DE DISEÑO PREMIUM (Vanilla CSS)
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Archivo:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400;1,600&display=swap');

:root {
    /* Color Palette */
    --primary-color: #8c1d2c;
    /* Deep Academic Green */
    --primary-hover: #520a14;
    /* Lighter Green */
    --primary-light: #e6eee9;
    /* Green Accent Background */
    --secondary-color: #8c1d2c;
    /* Elegant Gold */
    --text-main: #4e3f41;
    /* Charcoal Grey */
    --text-muted: #8b676c;
    /* Medium Grey */
    --bg-app: #ffffff;
    --bg-card: #ffffff;

    /* Semantic Colors */
    --color-success: #2ea44f;
    --color-success-bg: #e6f6ec;
    --color-error: #cf222e;
    --color-error-bg: #ffebe9;
    --color-warning: #7c5408;
    --color-warning-bg: #fff8e6;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.08);

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Global */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Archivo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-main);
    background: #ffffff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    line-height: 1.5;
}

.app-container {
    width: 80%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    animation: fadeIn var(--transition-normal);
}

@media (max-width: 768px) {
    .app-container {
        width: 95%;
    }
}

/* Header */
.app-header {
    text-align: center;
    padding: 10px 0;
}

.logo-container {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    text-align: left;
}

.logo-icon {
    width: 48px;
    height: 48px;
    color: var(--primary-color);
    background: white;
    padding: 8px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.logo-text h1 {
    font-family: 'Archivo', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.2;
}

.logo-text p {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Main Card */
.main-card {
    background: var(--bg-card);
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

/* Tabs Navigation */
.tab-navigation {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px 12px;
    background: var(--primary-color);
    border: none;
    font-family: 'Archivo', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-light);
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    outline: none;
}

.tab-btn::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    transition: var(--transition-fast);
}

.tab-btn:hover {
    color: var(--primary-color);
    background: rgba(241, 245, 249, 0.5);
}

.tab-btn.active {
    color: var(--primary-color);
    background: white;
}

.tab-btn.active::after {
    background: var(--primary-color);
}

.tab-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Tab Panels */
.tab-content {
    padding: 30px;
    min-height: 420px;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: slideUp var(--transition-normal);
}

.panel-header {
    margin-bottom: 25px;
}

.panel-header h2 {
    font-family: 'Archivo', sans-serif;
    font-size: 1.35rem;
    color: var(--primary-color);
    margin-bottom: 6px;
}

.panel-header p {
    font-size: 0.925rem;
    color: var(--text-muted);
}

/* Form Styles */
form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 500px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
}

.required {
    color: var(--color-error);
}

input[type="text"],
input[type="number"],
input[type="email"],
select {
    width: 100%;
    height: 46px;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: var(--transition-fast);
    outline: none;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
select:focus {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(7, 71, 59, 0.15);
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon input {
    padding-left: 42px;
}

.input-icon {
    position: absolute;
    left: 14px;
    width: 20px;
    height: 20px;
    fill: var(--text-muted);
    pointer-events: none;
}

.help-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Captcha styling */
.captcha-container {
    padding: 10px 0;
    display: flex;
    justify-content: flex-start;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 48px;
    padding: 0 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-family: 'Archivo', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
    margin-top: 10px;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(7, 71, 59, 0.2);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Feedback Alerts */
.alert {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    font-size: 0.925rem;
    margin-top: 20px;
    align-items: flex-start;
}

.alert-icon {
    font-size: 1.2rem;
    line-height: 1;
    flex-shrink: 0;
}

.alert-error {
    background: var(--color-error-bg);
    color: var(--color-error);
    border: 1px solid rgba(207, 34, 46, 0.15);
}

.alert-success {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid rgba(46, 164, 79, 0.15);
}

.alert-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border: 1px solid rgba(208, 135, 0, 0.15);
}

/* Loading Spinner */
.loading-spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 40px 0;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
}

.spinner {
    width: 38px;
    height: 38px;
    border: 3px solid rgba(7, 71, 59, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

/* Results Section */
.results-container {
    margin-top: 30px;
}

.results-header {
    font-family: 'Archivo', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 8px;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Voter Card */
.voter-card {
    background: white;
    border-radius: 14px;
    border: 1.5px solid #c2c2c2;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition-fast);
}

.voter-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.voter-card-header {
    background: #f8fafc;
    padding: 16px 20px;
    border-bottom: 1.5px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.voter-card-header h3 {
    font-family: 'Archivo', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary-color);
}

.badge-secondary {
    background: #edf2f7;
    color: var(--text-main);
    border: 1px solid #e2e8f0;
}

.badge-success {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid rgba(46, 164, 79, 0.25);
}

.badge-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border: 1px solid rgba(124, 84, 8, 0.25);
}

.voter-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    font-size: 0.925rem;
}

.info-label {
    color: var(--text-muted);
    font-weight: 500;
}

.info-value {
    color: var(--text-main);
    font-weight: 600;
    text-align: right;
}

.font-highlight {
    color: var(--primary-color);
    font-size: 1rem;
}

.info-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-top: 5px;
    padding-top: 15px;
    border-top: 1px dashed #07473b;
}

.info-grid .info-row {
    flex: 0 1 calc(33.333% - 10px);
    min-width: 140px;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.info-grid .info-value {
    font-size: 1rem;
    text-align: center;
}

/* Footer Styling */
.app-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 10px;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn var(--transition-fast) forwards;
}

.animate-slide-up {
    animation: slideUp var(--transition-normal) forwards;
}

/* Candidate Selection Cards */
.candidate-option-card {
    cursor: pointer;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    background: white;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease-in-out;
    display: block;
    margin-bottom: 12px;
    position: relative;
    user-select: none;
}

.candidate-option-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.candidate-option-card.selected {
    border-color: var(--primary-color);
    background: rgba(7, 71, 59, 0.03);
    box-shadow: 0 0 0 3px rgba(7, 71, 59, 0.15);
}

.candidate-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1.5px solid #e2e8f0;
    background: #f8fafc;
}

.candidate-radio-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.candidate-radio-wrapper input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.candidate-title {
    font-family: 'Archivo', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--primary-color);
}

.btn-secondary,
.btn-primary.btn-cancelar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 48px;
    padding: 0 24px;
    background: #64748b;
    color: white;
    border: none;
    border-radius: 10px;
    font-family: 'Archivo', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
    margin-top: 10px;
}

.btn-secondary:hover,
.btn-primary.btn-cancelar:hover {
    background: #475569;
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.25);
    transform: translateY(-1px);
}

.btn-secondary:active,
.btn-primary.btn-cancelar:active {
    transform: translateY(0);
}

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.selection-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    margin-top: 20px;
}

#recaptcha-confirmacion-container {
    padding: 0;
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

.selection-actions-buttons {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

.selection-actions-buttons .btn-primary,
.selection-actions-buttons .btn-primary.btn-cancelar {
    margin-top: 0;
}