@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --bg-color: #0f172a;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #8b5cf6;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    padding: 3rem 1rem;
    position: relative;
    overflow: hidden;
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(to right, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
}

/* Payment Info Section */
.payment-info {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 3rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
}

.payment-method {
    flex: 1;
    min-width: 200px;
    text-align: center;
}

.payment-method h3 {
    color: var(--accent);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.payment-method p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Cartones */
.cartones-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
}

.carton {
    flex: 1;
    min-width: 280px;
    max-width: 320px;
    background: linear-gradient(270deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.8), rgba(30, 41, 59, 0.8));
    background-size: 200% 200%;
    animation: CartonGradient 8s ease infinite;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3), inset 0 0 20px rgba(59, 130, 246, 0.1);
}

@keyframes CartonGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.carton-title {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    font-weight: 600;
}

.numbers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 0.5rem;
}

/* Tickets (Numbers) */
.ticket {
    aspect-ratio: 1;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.ticket:hover:not(.reserved):not(.paid) {
    background: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}

.ticket.reserved, .ticket.paid {
    cursor: not-allowed;
    background: rgba(255,255,255,0.1);
    color: transparent; /* Ocultar el número */
}

.ticket.reserved::after, .ticket.paid::after {
    content: '🎟️';
    position: absolute;
    font-size: 1.5rem;
    color: white;
}

.ticket.paid::after {
    content: '✔️';
    color: var(--success);
}

.ticket .user-tooltip {
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: #fff;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    white-space: nowrap;
    z-index: 10;
}

.ticket:hover .user-tooltip {
    opacity: 1;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 100;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--bg-color);
    border: 1px solid var(--glass-border);
    padding: 2.5rem;
    border-radius: 1.5rem;
    width: 90%;
    max-width: 400px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group select option {
    background-color: #fff;
    color: #000;
}

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

.btn {
    width: 100%;
    padding: 0.8rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-cancel {
    background: transparent;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.btn-cancel:hover {
    color: white;
}

/* Admin Styles */
.admin-panel {
    background: var(--glass-bg);
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
    margin-bottom: 2rem;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

th {
    color: var(--text-muted);
    font-weight: 600;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge.reserved { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge.paid { background: rgba(16, 185, 129, 0.2); color: var(--success); }

/* Winner animation */
.winner-banner {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    text-align: center;
    padding: 1.5rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    font-size: 1.5rem;
    font-weight: 800;
    animation: pulse 2s infinite;
    box-shadow: 0 10px 25px rgba(245, 158, 11, 0.3);
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Responsive */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: rgba(0,0,0,0.2);
    padding: 0.5rem;
    border-radius: 1rem;
    flex-wrap: wrap; /* Permitir que los tabs bajen de línea en móviles */
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    header {
        padding: 1.5rem 1rem;
    }
    
    .admin-panel {
        padding: 1rem;
    }
    
    .payment-info {
        flex-direction: column;
    }
    
    .numbers-grid {
        grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
        gap: 0.25rem;
    }
    
    .ticket {
        font-size: 1rem;
    }

    .ticket.reserved::after, .ticket.paid::after {
        font-size: 1.2rem;
    }
    
    .tabs .tab-btn {
        flex: 1;
        min-width: 45%;
        text-align: center;
    }
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 12px 20px;
    color: var(--text-main);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    transform: translateX(0);
}

.toast-error { border-left: 4px solid var(--danger); }
.toast-success { border-left: 4px solid var(--success); }
.toast-info { border-left: 4px solid var(--primary); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-bell { border-left: 4px solid #fcd34d; background: rgba(245, 158, 11, 0.2); }

/* Custom Modals (Confirm/Prompt) */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10000;
}

.custom-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.custom-modal-content {
    background: var(--bg-color);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 1rem;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    transform: translateY(20px);
    transition: transform 0.2s;
}

.custom-modal-overlay.active .custom-modal-content {
    transform: translateY(0);
}
