/* Estilos personalizados para el Balotario */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c1
-light-bg: #ecf0f1;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(45deg, #27ae60, #58d68d);
    --gradient-danger: linear-gradient(45deg, #e74c3c, #ec7063);
    --gradient-warning: linear-gradient(45deg, #f39c12, #f7dc6f);
}

/* Animaciones personalizadas */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Efectos de hover mejorados */
.card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

/* Botones con efectos especiales */
.btn-glow {
    position: relative;
    overflow: hidden;
}

.btn-glow::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn-glow:hover::before {
    left: 100%;
}

/* Indicadores de progreso mejorados */
.progress-ring {
    width: 120px;
    height: 120px;
    position: relative;
}

.progress-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-ring circle {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
}

.progress-ring .bg {
    stroke: rgba(255,255,255,0.2);
}

.progress-ring .progress {
    stroke: #fff;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 0.5s ease-in-out;
}

/* Efectos de texto */
.text-glow {
    text-shadow: 0 0 10px rgba(255,255,255,0.5);
}

.text-gradient {
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Tarjetas de preguntas mejoradas - tema claro por defecto */
.question-card-enhanced {
    background: white;
    color: #333333;
    border-radius: 20px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.question-card-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

/* Opciones de respuesta mejoradas */
.option-enhanced {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.option-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(52, 152, 219, 0.1), transparent);
    transition: left 0.3s ease;
    pointer-events: none;
}

.option-enhanced:hover::before {
    left: 100%;
}

.option-enhanced:hover {
    border-color: var(--secondary-color);
    transform: translateX(5px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.2);
}

.option-enhanced.selected {
    border-color: var(--secondary-color);
    background: rgba(52, 152, 219, 0.25);
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.option-enhanced.correct {
    border-color: var(--success-color);
    background: rgba(39, 174, 96, 0.25);
    animation: pulse 0.6s ease-in-out;
    color: #1e5631;
    font-weight: 600;
}

.option-enhanced.incorrect {
    border-color: var(--danger-color);
    background: rgba(231, 76, 60, 0.25);
    color: #721c24;
    font-weight: 600;
}

/* Navegador de preguntas mejorado */
.question-navigator {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.nav-question-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid #e9ecef;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: all 0.3s ease;
    margin: 5px;
}

.nav-question-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.nav-question-btn.answered {
    background: var(--gradient-success);
    border-color: var(--success-color);
    color: white;
}

.nav-question-btn.current {
    background: var(--gradient-primary);
    border-color: var(--secondary-color);
    color: white;
    animation: pulse 2s infinite;
}

/* Timer mejorado */
.timer-display {
    background: var(--gradient-warning);
    color: white;
    padding: 15px 25px;
    border-radius: 25px;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 8px 25px rgba(243, 156, 18, 0.3);
    position: relative;
}

.timer-display.warning {
    background: var(--gradient-danger);
    animation: pulse 1s infinite;
}

/* Estadísticas mejoradas */
.stats-enhanced {
    background: var(--gradient-primary);
    color: white;
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.stats-enhanced::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.stats-number {
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Responsive mejoras */
@media (max-width: 768px) {
    .question-card-enhanced {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .option-enhanced {
        padding: 15px;
        margin-bottom: 10px;
    }

    .nav-question-btn {
        width: 40px;
        height: 40px;
        margin: 3px;
    }

    .timer-display {
        font-size: 1.2rem;
        padding: 10px 20px;
    }
}

/* Tema claro - respuestas seleccionadas más intensas */
[data-theme="light"] .option-enhanced.selected,
:root:not([data-theme="dark"]) .option-enhanced.selected {
    border-color: var(--secondary-color);
    background: rgba(52, 152, 219, 0.35);
    transform: translateX(5px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
    border-width: 3px;
}

[data-theme="light"] .option-btn.selected,
:root:not([data-theme="dark"]) .option-btn.selected {
    background: rgba(52, 152, 219, 0.35) !important;
    border-color: var(--secondary-color) !important;
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4) !important;
    border-width: 3px !important;
}

/* Tema claro - respuestas correctas más intensas */
[data-theme="light"] .option-enhanced.correct,
:root:not([data-theme="dark"]) .option-enhanced.correct {
    border-color: #1e7e34;
    background: rgba(39, 174, 96, 0.4);
    color: #0d4016;
    font-weight: 700;
    border-width: 3px;
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.3);
}

[data-theme="light"] .option-btn.correct,
:root:not([data-theme="dark"]) .option-btn.correct {
    background: rgba(39, 174, 96, 0.4) !important;
    border-color: #1e7e34 !important;
    color: #0d4016 !important;
    font-weight: 700 !important;
    border-width: 3px !important;
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.3) !important;
}

/* Tema claro - respuestas incorrectas más intensas */
[data-theme="light"] .option-enhanced.incorrect,
:root:not([data-theme="dark"]) .option-enhanced.incorrect {
    border-color: #c82333;
    background: rgba(231, 76, 60, 0.4);
    color: #721c24;
    font-weight: 700;
    border-width: 3px;
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.3);
}

[data-theme="light"] .option-btn.incorrect,
:root:not([data-theme="dark"]) .option-btn.incorrect {
    background: rgba(231, 76, 60, 0.4) !important;
    border-color: #c82333 !important;
    color: #721c24 !important;
    font-weight: 700 !important;
    border-width: 3px !important;
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.3) !important;
}

/* Modal support for light theme - ensuring proper styling */
[data-theme="light"] .modal-content,
:root:not([data-theme="dark"]) .modal-content {
    background: #ffffff !important;
    color: #333333 !important;
    border: 1px solid #dee2e6 !important;
}

[data-theme="light"] .modal-header,
:root:not([data-theme="dark"]) .modal-header {
    border-bottom-color: #dee2e6 !important;
}

[data-theme="light"] .modal-footer,
:root:not([data-theme="dark"]) .modal-footer {
    border-top-color: #dee2e6 !important;
}

[data-theme="light"] .modal-title,
:root:not([data-theme="dark"]) .modal-title {
    color: #333333 !important;
}

/* Tema claro - question cards */
[data-theme="light"] .question-card-enhanced,
:root:not([data-theme="dark"]) .question-card-enhanced {
    background: white !important;
    color: #333333 !important;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1) !important;
}

[data-theme="light"] .question-card,
:root:not([data-theme="dark"]) .question-card {
    background: white !important;
    color: #333333 !important;
}

/* Modo oscuro */
[data-theme="dark"] {
    background: #1a1a1a !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] body {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%) !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] .container-main {
    background: rgba(44, 62, 80, 0.95) !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] .card {
    background: #34495e !important;
    color: #e0e0e0 !important;
    border-color: #4a5f7a !important;
}

[data-theme="dark"] .question-card,
[data-theme="dark"] .question-card-enhanced {
    background: #34495e !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] .option-btn,
[data-theme="dark"] .option-enhanced {
    background: #2c3e50 !important;
    border-color: #4a5f7a !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] .option-btn:hover,
[data-theme="dark"] .option-enhanced:hover {
    background: #3d566e !important;
    border-color: var(--secondary-color) !important;
}

[data-theme="dark"] .option-btn.correct,
[data-theme="dark"] .option-enhanced.correct {
    background: rgba(39, 174, 96, 0.3) !important;
    border-color: #27ae60 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .option-btn.incorrect,
[data-theme="dark"] .option-enhanced.incorrect {
    background: rgba(231, 76, 60, 0.3) !important;
    border-color: #e74c3c !important;
    color: #ffffff !important;
}

[data-theme="dark"] .option-btn.selected,
[data-theme="dark"] .option-enhanced.selected {
    background: rgba(52, 152, 219, 0.3) !important;
    border-color: #3498db !important;
    color: #ffffff !important;
}

[data-theme="dark"] .navbar {
    background: rgba(26, 26, 26, 0.95) !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background: #2c3e50 !important;
    border-color: #4a5f7a !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background: #34495e !important;
    border-color: var(--secondary-color) !important;
    color: #e0e0e0 !important;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25) !important;
}

[data-theme="dark"] .alert-success {
    background: rgba(39, 174, 96, 0.2) !important;
    border-color: var(--success-color) !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] .alert-danger {
    background: rgba(231, 76, 60, 0.2) !important;
    border-color: var(--danger-color) !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] .badge {
    color: #fff !important;
}

[data-theme="dark"] .text-muted {
    color: #bbb !important;
}

[data-theme="dark"] .correct-option {
    background: rgba(39, 174, 96, 0.4) !important;
    border-color: #27ae60 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .answer-indicator {
    color: #27ae60 !important;
}

[data-theme="dark"] .fa-check-circle {
    color: #27ae60 !important;
}

[data-theme="dark"] .text-success {
    color: #2ecc71 !important;
}

[data-theme="dark"] .text-danger {
    color: #e74c3c !important;
}

[data-theme="dark"] .text-warning {
    color: #f39c12 !important;
}

[data-theme="dark"] .text-primary {
    color: #3498db !important;
}

/* Modal support for dark theme */
[data-theme="dark"] .modal-content {
    background: #2c3e50 !important;
    color: #e0e0e0 !important;
    border: 1px solid #4a5f7a !important;
}

[data-theme="dark"] .modal-header {
    border-bottom-color: #4a5f7a !important;
}

[data-theme="dark"] .modal-footer {
    border-top-color: #4a5f7a !important;
}

[data-theme="dark"] .modal-title {
    color: #e0e0e0 !important;
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Buttons in dark theme */
[data-theme="dark"] .btn-secondary {
    background: #4a5f7a !important;
    border-color: #4a5f7a !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] .btn-secondary:hover {
    background: #5a6f8a !important;
    border-color: #5a6f8a !important;
}

[data-theme="dark"] .btn-outline-secondary {
    border-color: #4a5f7a !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] .btn-outline-secondary:hover {
    background: #4a5f7a !important;
    border-color: #4a5f7a !important;
    color: #ffffff !important;
}

[data-theme="dark"] .btn-outline-primary {
    border-color: var(--secondary-color) !important;
    color: var(--secondary-color) !important;
}

[data-theme="dark"] .btn-outline-primary:hover {
    background: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
    color: #ffffff !important;
}

/* Progress bars in dark theme */
[data-theme="dark"] .progress {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* Badges in dark theme */
[data-theme="dark"] .badge.bg-warning {
    background: var(--warning-color) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .badge.bg-success {
    background: var(--success-color) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .badge.bg-primary {
    background: var(--secondary-color) !important;
    color: #ffffff !important;
}

/* Question navigator buttons in dark theme */
[data-theme="dark"] .question-nav-btn,
[data-theme="dark"] .nav-question-btn {
    background: #2c3e50 !important;
    border-color: #4a5f7a !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] .question-nav-btn:hover,
[data-theme="dark"] .nav-question-btn:hover {
    background: #3d566e !important;
    border-color: var(--secondary-color) !important;
}

[data-theme="dark"] .question-nav-btn.btn-success,
[data-theme="dark"] .nav-question-btn.answered {
    background: var(--success-color) !important;
    border-color: var(--success-color) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .question-nav-btn.btn-primary,
[data-theme="dark"] .nav-question-btn.current {
    background: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
    color: #ffffff !important;
}

/* Timer and other exam elements */
[data-theme="dark"] .timer-display {
    background: var(--gradient-warning) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .timer-display.warning {
    background: var(--gradient-danger) !important;
}

/* Question navigator card */
[data-theme="dark"] .question-navigator {
    background: rgba(44, 62, 80, 0.95) !important;
    color: #e0e0e0 !important;
}

/* Modal theme support only - no interference with Bootstrap functionality */

/* Modal with reasonable z-index */
.modal {
    z-index: 1055;
}

.modal-backdrop {
    z-index: 1050;
}

/* Custom modal styling */
#confirmModal {
    z-index: 1055;
}

#confirmBackdrop {
    z-index: 1050;
}

#confirmDialog {
    z-index: 1055;
}

/* Prevent scroll when modal is open */
body.modal-open {
    overflow: hidden;
}

/* Ensure modal doesn't cause horizontal scroll */
#confirmModal {
    overflow-x: hidden;
    overflow-y: auto;
}

#confirmDialog {
    margin: 20px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
}

/* Force modal to be centered and visible */
#confirmModal.show {
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
    width: auto !important;
    height: auto !important;
}

#confirmModal .modal-dialog {
    margin: 0 !important;
    position: relative !important;
}

/* Ensure backdrop covers entire screen */
.modal-backdrop.show {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
}

/* Custom modal theme support */
[data-theme="dark"] #confirmDialog {
    background: #2c3e50 !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] #confirmDialog h5 {
    color: #e0e0e0 !important;
}

[data-theme="dark"] #confirmDialog p {
    color: #e0e0e0 !important;
}

[data-theme="dark"] #confirmDialog #confirm-message {
    color: #e0e0e0 !important;
}

[data-theme="dark"] #confirmModalClose {
    color: #e0e0e0 !important;
}

/* Modo oscuro automático removido para evitar conflictos */

/* Efectos de carga */
.loading-dots {
    display: inline-block;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Confetti effect para celebrar */
.confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1040;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #f39c12;
    animation: confetti-fall 3s linear infinite;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}
