:root {
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --primary-light: #818CF8;
    --secondary: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
}

.logo-icon {
    font-size: 28px;
}

.nav {
    display: flex;
    gap: 30px;
}

.nav-link {
    text-decoration: none;
    color: var(--gray-600);
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

/* Hero */
.hero {
    position: relative;
    padding: 80px 0;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0.05;
    transform: skewY(-3deg);
    transform-origin: top left;
}

.hero-content {
    position: relative;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: 48px;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 20px;
    line-height: 1.2;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 20px;
    color: var(--gray-600);
    margin-bottom: 40px;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-top: 40px;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 36px;
    font-weight: 800;
    color: var(--primary);
}

.stat-label {
    color: var(--gray-500);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Main Layout */
.main {
    display: grid;
    grid-template-columns: 1fr 520px;
    gap: 30px;
    padding-bottom: 60px;
}

/* Rifa Card */
.rifa-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: grid;
    grid-template-columns: 500px 1fr;
    margin-bottom: 10px;
}

.rifa-image {
    position: auto;
    height: 35%;
    min-height: 550px;
}

.rifa-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rifa-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    background: linear-gradient(135deg, #F59E0B 0%, #EF4444 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: var(--shadow-md);
}

.rifa-details {
    padding: 40px;
}

.rifa-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 15px;
}

.rifa-description {
    color: var(--gray-600);
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 30px;
}

.rifa-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: var(--gray-50);
    border-radius: var(--radius-lg);
}

.meta-icon {
    font-size: 24px;
}

.meta-label {
    display: block;
    font-size: 12px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.meta-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
}

.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--gray-500);
}

/* Números Section */
.numeros-section {
    background: white;
    border-radius: var(--radius-xl);
    padding: 0px;
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h3 {
    font-size: 24px;
    font-weight: 700;
}

.filtros {
    display: flex;
    gap: 10px;
}

.filtro-btn {
    padding: 8px 16px;
    border: 2px solid var(--gray-200);
    background: white;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.filtro-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

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

.numeros-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
    flex-wrap: wrap;
}

.buscador {
    display: flex;
    gap: 10px;
}

.buscador input {
    padding: 10px 15px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    width: 200px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.buscador input:focus {
    outline: none;
    border-color: var(--primary);
}

.acciones-masa {
    display: flex;
    gap: 10px;
}

/* Grid de Números */
.numeros-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
    max-height: 600px;
    overflow-y: auto;
    padding:20px;
    background: var(--gray-50);
    border-radius: var(--radius-lg);
}

.numero-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    border: 2px solid transparent;
    user-select: none;
}

.numero-item.disponible {
    background: white;
    color: var(--gray-700);
    box-shadow: var(--shadow-sm);
}

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

.numero-item.seleccionado {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
    animation: pulse 0.3s ease;
}

@keyframes pulse {
    0%, 100% { transform: scale(1.05); }
    50% { transform: scale(1.1); }
}

.numero-item.vendido {
    background: var(--gray-200);
    color: var(--gray-400);
    cursor: not-allowed;
    text-decoration: line-through;
}

.numero-item.reservado {
    background: #FEF3C7;
    color: #D97706;
    cursor: wait;
}

.numero-item .tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-900);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.numero-item:hover .tooltip {
    opacity: 1;
}

/* Checkout Panel */
.checkout-panel {
    position: sticky;
    top: 90px;
    height: fit-content;
}

.checkout-content {
    background: white;
    border-radius: var(--radius-xl);
    padding: 25px;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--gray-100);
}

.checkout-content h4 {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--gray-900);
}

.selected-numbers {
    min-height: 100px;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--primary);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 14px;
    margin: 3px;
    animation: tagIn 0.3s ease;
}

@keyframes tagIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.selected-tag .remove {
    cursor: pointer;
    font-weight: bold;
    opacity: 0.8;
}

.selected-tag .remove:hover {
    opacity: 1;
}

.empty-state {
    color: var(--gray-400);
    text-align: center;
    padding: 40px 20px;
    font-style: italic;
}

.checkout-summary {
    border-top: 2px solid var(--gray-100);
    padding-top: 20px;
    margin-bottom: 20px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    color: var(--gray-600);
}

.summary-row.total {
    font-size: 20px;
    color: var(--gray-900);
    font-weight: 700;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--gray-200);
}

/* Botones */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    border-radius: var(--radius-lg);
}

.btn-block {
    width: 100%;
    padding: 16px;
    font-size: 16px;
}

.checkout-note {
    text-align: center;
    margin-top: 15px;
    font-size: 12px;
    color: var(--gray-500);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    padding: 40px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalIn 0.3s ease;
    box-shadow: var(--shadow-xl);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--gray-400);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.modal h2 {
    font-size: 28px;
    margin-bottom: 10px;
    color: var(--gray-900);
}

.modal-subtitle {
    color: var(--gray-500);
    margin-bottom: 30px;
}

/* Formulario */
.form-compra .form-group {
    margin-bottom: 20px;
}

.form-compra label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--gray-700);
}

.form-compra input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 16px;
    transition: border-color 0.2s;
}

.form-compra input:focus {
    outline: none;
    border-color: var(--primary);
}

.resumen-compra {
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin: 25px 0;
}

.resumen-compra h4 {
    margin-bottom: 15px;
    font-size: 16px;
}

.resumen-numeros {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    max-height: 100px;
    overflow-y: auto;
}

.resumen-numero {
    background: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    border: 1px solid var(--gray-200);
}

.resumen-total {
    display: flex;
    justify-content: space-between;
    padding-top: 15px;
    border-top: 2px solid var(--gray-200);
    font-size: 18px;
    font-weight: 700;
}

.form-note {
    text-align: center;
    margin-top: 15px;
    font-size: 13px;
    color: var(--gray-500);
}

/* Estados de carga y éxito */
.loading-state {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.success-icon-large {
    width: 80px;
    height: 80px;
    background: var(--secondary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 20px;
    animation: scaleIn 0.5s ease;
}

.success-state {
    text-align: center;
    padding: 20px;
}

.success-state h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--gray-900);
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    padding: 16px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastIn 0.3s ease;
    min-width: 300px;
    border-left: 4px solid var(--primary);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.success {
    border-left-color: var(--secondary);
}

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Loading overlay */
.loading {
    display: none;
    text-align: center;
    padding: 60px;
}

.loading.active {
    display: block;
}

/* Responsive */
@media (max-width: 1024px) {
    .main {
        grid-template-columns: 1fr;
    }
    
    .checkout-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 50;
        padding: 0;
    }
    
    .checkout-content {
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    .rifa-card {
        grid-template-columns: 1fr;
    }
    
    .rifa-image {
        height: 250px;
    }
}

@media (max-width: 640px) {
    .hero-title {
        font-size: 32px;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 20px;
    }
    
    .rifa-meta {
        grid-template-columns: 1fr;
    }
    
    .numeros-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filtros {
        justify-content: center;
    }
}