/* Variables de color de marca */
:root {
    --brand-red: #D62A34;
    --brand-gray: #D2D2D2;
    --brand-blue: #003372;
    --brand-sky-blue: #6AA5D8;
    --text-dark: #2C3E50;
    --text-light: #6C757D;
    --bg-light: #F8F9FA;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --border-radius: 12px;
}

/* Header fijo */
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: var(--shadow);
    z-index: 1000;
    padding: 15px 0;
    border-bottom: 1px solid var(--brand-gray);
}

.header-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.header-logo {
    max-height: 50px;
    max-width: 150px;
    object-fit: contain;
}

/* Ajustar contenido principal para header fijo */
.main-content {
    margin-top: 90px;
}

/* Estilos generales */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

/* Header principal */
.bg-primary {
    background: linear-gradient(135deg, var(--brand-red) 0%, var(--brand-blue) 100%) !important;
}

/* Cards */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: white;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

/* Botones */
.btn {
    border-radius: 8px;
    padding: 12px 24px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-red) 0%, var(--brand-blue) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(214, 42, 52, 0.3);
    background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-red) 100%);
}

.btn-outline-primary {
    border: 2px solid var(--brand-blue);
    color: var(--brand-blue);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--brand-blue);
    color: white;
    transform: translateY(-1px);
}

.btn-outline-secondary {
    border: 2px solid var(--brand-gray);
    color: var(--text-dark);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--brand-gray);
    color: var(--text-dark);
}

.btn-success {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border: none;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.4);
}

/* Iconos de pasos */
.step-icon {
    font-size: 3rem;
    color: var(--brand-blue);
    margin-bottom: 1rem;
}

/* Área de drop para archivos */
.drop-area {
    border: 2px dashed #dee2e6;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #f8f9fa;
}

.drop-area:hover,
.drop-area.dragover {
    border-color: var(--brand-blue);
    background: rgba(106, 165, 216, 0.1);
}

.drop-content .drop-icon {
    font-size: 4rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

/* Información del archivo */
.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #e9ecef;
    padding: 10px 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.file-name {
    font-weight: 500;
    color: #495057;
}

/* Spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Número de ticket */
.ticket-number {
    background: linear-gradient(135deg, var(--brand-red) 0%, var(--brand-blue) 100%);
    color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    text-align: center;
    margin: 20px 0;
}

.ticket-label {
    font-size: 1.1rem;
    margin-bottom: 10px;
    opacity: 0.9;
}

.ticket-value {
    font-size: 3rem;
    font-weight: bold;
    letter-spacing: 2px;
}

/* Información del participante */
.participant-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
}

/* Comprobante de participación */
.participation-receipt {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 2px solid var(--brand-gray);
    max-width: 800px;
    margin: 0 auto;
}

/* Header del comprobante */
.receipt-header {
    background: linear-gradient(135deg, var(--brand-red) 0%, var(--brand-blue) 100%);
    color: white;
    padding: 20px;
    border-bottom: 3px solid var(--brand-gray);
}

.receipt-logo {
    max-height: 60px;
    max-width: 120px;
    object-fit: contain;
}

.receipt-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    color: white;
}

.receipt-subtitle {
    font-size: 1rem;
    margin: 5px 0 0 0;
    opacity: 0.9;
    color: white;
}

.success-badge {
    background: #28a745;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.success-badge i {
    font-size: 1.2rem;
}

/* Número de participación */
.participation-number {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 30px 20px;
    text-align: center;
    border-bottom: 2px solid var(--brand-gray);
}

.number-label {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 10px;
    font-weight: 500;
}

.number-value {
    font-size: 4rem;
    font-weight: 900;
    color: var(--brand-red);
    margin: 15px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: 3px;
}

.number-description {
    font-size: 0.9rem;
    color: var(--text-light);
    font-style: italic;
}

/* Detalles del participante */
.participant-details, .raffle-info, .important-notes {
    padding: 25px 20px;
    border-bottom: 1px solid var(--brand-gray);
}

.section-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--brand-blue);
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--brand-blue);
}

.detail-item label {
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.detail-item span {
    color: var(--text-light);
    font-weight: 500;
}

/* Información del sorteo */
.info-content p {
    margin-bottom: 8px;
    padding: 5px 0;
}

.info-content strong {
    color: var(--brand-blue);
}

/* Notas importantes */
.notes-list {
    padding-left: 20px;
}

.notes-list li {
    margin-bottom: 8px;
    color: var(--text-light);
}

.notes-list li:before {
    content: "✓";
    color: var(--brand-blue);
    font-weight: bold;
    margin-right: 10px;
}

/* Código de verificación */
.verification-code {
    background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-sky-blue) 100%);
    color: white;
    padding: 20px;
    text-align: center;
    border-bottom: 2px solid var(--brand-gray);
}

.code-label {
    font-size: 1rem;
    margin-bottom: 10px;
    opacity: 0.9;
}

.code-value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
}

/* Footer del comprobante */
.receipt-footer {
    background: #f8f9fa;
    padding: 25px 20px;
}

.signature-line {
    text-align: center;
    margin-bottom: 20px;
}

.signature-line .line {
    height: 2px;
    background: var(--brand-gray);
    margin-bottom: 5px;
    width: 200px;
    margin: 0 auto 5px auto;
}

.signature-line .label {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
}

.footer-text {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--brand-gray);
}

.footer-text small {
    color: var(--text-light);
}

/* Botones de acción */
.action-buttons {
    text-align: center;
}

.action-buttons .btn {
    margin: 0 10px;
    min-width: 180px;
}

/* Mensaje de felicitación */
.congratulations-message {
    max-width: 600px;
    margin: 0 auto;
}

.congratulations-message .alert {
    border-radius: var(--border-radius);
    border: none;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
}

.congratulations-message .alert-heading {
    color: #155724;
    font-weight: 700;
}

/* Responsive */
@media (max-width: 768px) {
    .participation-receipt {
        margin: 0 15px;
    }

    .receipt-header {
        padding: 15px;
    }

    .receipt-title {
        font-size: 1.5rem;
    }

    .number-value {
        font-size: 3rem;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons .btn {
        display: block;
        width: 100%;
        margin: 10px 0;
    }
}

/* Estilos de impresión */
@media print {
    .action-buttons, .fixed-header, footer {
        display: none !important;
    }

    .participation-receipt {
        box-shadow: none;
        border: 1px solid #000;
    }

    .receipt-header {
        background: #f0f0f0 !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
    }

    .success-badge {
        background: #28a745 !important;
        -webkit-print-color-adjust: exact;
    }
}

/* Formularios */
.form-control:focus {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 0.2rem rgba(0, 51, 114, 0.25);
}

.form-select:focus {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 0.2rem rgba(0, 51, 114, 0.25);
}

/* Alertas */
.alert {
    border-radius: 10px;
    border: none;
}

/* Footer */
footer {
    margin-top: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .display-4 {
        font-size: 2.5rem;
    }

    .btn-lg {
        padding: 12px 24px;
        font-size: 1rem;
    }

    .step-icon {
        font-size: 2.5rem;
    }

    .drop-area {
        padding: 30px 20px;
    }

    .ticket-value {
        font-size: 2.5rem;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Estados de carga */
.loading {
    pointer-events: none;
    opacity: 0.7;
}

/* Mensajes de error/éxito */
.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: #c3e6cb;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border-color: #f5c6cb;
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    border-color: #bee5eb;
}

/* Animación del escáner */
.scanner-container {
    position: relative;
    display: inline-block;
    margin: 20px auto;
}

.image-frame {
    position: relative;
    display: inline-block;
    border: 3px solid #007bff;
    border-radius: 15px;
    padding: 10px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.3);
    overflow: hidden;
}

.scanned-ticket {
    max-width: 500px;
    max-height: 400px;
    border-radius: 10px;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}

.scanner-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent 0%, #28a745 50%, transparent 100%);
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.8);
    animation: scan 2s linear infinite;
}

@keyframes scan {
    0% {
        top: 0;
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        top: 100%;
        opacity: 1;
    }
}

/* Efecto de brillo en el marco */
.image-frame::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(45deg, #007bff, #28a745, #007bff);
    border-radius: 18px;
    z-index: -1;
    animation: borderGlow 3s ease-in-out infinite;
}

@keyframes borderGlow {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* Vista previa de imagen seleccionada */
.image-preview-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.preview-frame {
    position: relative;
    display: inline-block;
    border: 2px solid var(--brand-blue);
    border-radius: 10px;
    padding: 8px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.2);
}

.preview-ticket {
    max-width: 300px;
    max-height: 200px;
    border-radius: 8px;
    display: block;
    object-fit: contain;
}

.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 123, 255, 0.1);
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.preview-frame:hover .preview-overlay {
    opacity: 1;
}

.preview-text {
    color: var(--brand-blue);
    font-weight: 600;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--brand-blue);
}

/* Cuadro unificado para subida, vista previa y escaneo */
.unified-main-container {
    position: relative;
    min-height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Estado inicial: Área de drop */
.drop-area {
    width: 100%;
    min-height: 200px;
    border: 2px dashed var(--brand-blue);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    transition: all 0.3s ease;
    cursor: pointer;
}

.drop-area:hover {
    border-color: var(--brand-blue);
    background: linear-gradient(135deg, #e9ecef 0%, #f8f9fa 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.2);
}

.drop-area.dragover {
    border-color: var(--brand-blue);
    background: linear-gradient(135deg, #e0f7ff 0%, #b3e5fc 100%);
    transform: scale(1.02);
}

/* Estado con imagen: Vista previa y escaneo */
.image-unified-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.unified-frame {
    position: relative;
    display: inline-block;
    border: 3px solid var(--brand-blue);
    border-radius: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.3);
    max-width: 100%;
    overflow: hidden;
    transition: all 0.3s ease;
}

.unified-image {
    max-width: 500px;
    max-height: 400px;
    border-radius: 10px;
    display: block;
    margin: 0 auto;
    object-fit: contain;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.unified-info {
    position: absolute;
    bottom: 15px;
    left: 15px;
    right: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 15px;
    border-radius: 25px;
    border: 2px solid var(--brand-blue);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

/* Estado de escaneo */
.unified-frame.scanning {
    animation: scanningPulse 2s ease-in-out infinite;
}

.unified-frame.scanning .unified-info {
    opacity: 0.7;
    pointer-events: none;
}

@keyframes scanningPulse {
    0%, 100% {
        box-shadow: 0 8px 25px rgba(0, 123, 255, 0.3);
    }
    50% {
        box-shadow: 0 8px 35px rgba(40, 167, 69, 0.5);
    }
}