/* ========== BUY PAGE ========== */
.buy-main {
    padding-top: 160px;
    min-height: 100vh;
}

/* Selector de rifa */
.buy-select-section {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 24px 80px;
}

.rifa-select-card {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(26,26,26,0.8);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.3s ease;
}

.rifa-select-card:hover {
    border-color: rgba(244,197,66,0.3);
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(200,16,46,0.2);
}

.rifa-select-img {
    width: 100px;
    height: 100px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
}

.rifa-select-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rifa-select-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #8B0000, #1A1A1A);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: rgba(255,255,255,0.3);
}

.rifa-select-info h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: #fff;
}

.rifa-select-price {
    color: #F4C542;
    font-size: 1.2rem;
    font-weight: 700;
}

.rifa-select-price small {
    font-size: 0.75rem;
    font-weight: 400;
    color: rgba(255,255,255,0.4);
}

/* ========== RIFA INFO ========== */
.buy-hero {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px 40px;
}

.buy-rifa-info {
    display: flex;
    gap: 28px;
    align-items: center;
    background: rgba(26,26,26,0.7);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    padding: 24px;
}

.buy-rifa-img {
    width: 160px;
    height: 160px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
}

.buy-rifa-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.buy-rifa-details h1 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.buy-rifa-desc {
    color: rgba(255,255,255,0.5);
    font-size: 0.9rem;
    margin-bottom: 14px;
}

.buy-rifa-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.buy-price {
    color: #F4C542;
    font-weight: 700;
    font-size: 1.05rem;
}

.buy-date {
    color: rgba(255,255,255,0.45);
    font-size: 0.9rem;
}

.buy-rifa-meta i {
    margin-right: 6px;
}

/* ========== SECCIONES ========== */
.buy-section {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px 48px;
}

/* ========== RULETA ========== */
.ruleta-container {
    text-align: center;
    background: rgba(26,26,26,0.6);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    padding: 40px 24px;
}

.ruleta-container h2 {
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.ruleta-container h2 i {
    color: #F4C542;
    margin-right: 8px;
}

.ruleta-container > p {
    color: rgba(255,255,255,0.45);
    font-size: 0.9rem;
    margin-bottom: 28px;
}

.ruleta-wrapper {
    position: relative;
    width: 260px;
    height: 260px;
    margin: 0 auto 28px;
}

.ruleta-pointer {
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    font-size: 2rem;
    color: #F4C542;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
}

.ruleta-wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    border: 4px solid rgba(244,197,66,0.4);
    box-shadow: 0 0 30px rgba(200,16,46,0.2), inset 0 0 20px rgba(0,0,0,0.3);
}

.ruleta-segment {
    position: absolute;
    width: 50%;
    height: 50%;
    top: 0;
    left: 50%;
    transform-origin: 0% 100%;
    transform: rotate(var(--rotate)) skewY(-60deg);
    background: var(--bg);
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.ruleta-segment span {
    display: block;
    transform: skewY(60deg) rotate(15deg);
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    margin-top: 14px;
    margin-left: -20px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.ruleta-result {
    margin-top: 16px;
    font-size: 0.95rem;
    min-height: 28px;
}

.ruleta-result.success {
    color: #4CAF50;
}

.ruleta-result.info {
    color: #F4C542;
}

/* ========== RULETA DE LA SUERTE ========== */
.ruleta-suerte {
    text-align: center;
    background: rgba(26,26,26,0.6);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    padding: 40px 24px;
}

.ruleta-suerte h2 {
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.ruleta-suerte h2 i {
    color: #F4C542;
    margin-right: 8px;
}

.ruleta-suerte > p {
    color: rgba(255,255,255,0.45);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.ruleta-inputs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.ruleta-num {
    width: 64px;
    height: 64px;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    background: rgba(0,0,0,0.5);
    border: 2px solid rgba(244,197,66,0.3);
    border-radius: 12px;
    color: #F4C542;
    outline: none;
    transition: border-color 0.3s ease;
    font-family: 'Inter', monospace;
}

.ruleta-num:focus {
    border-color: #F4C542;
    box-shadow: 0 0 12px rgba(244,197,66,0.2);
}

.ruleta-num::placeholder {
    color: rgba(244,197,66,0.3);
}

.ruleta-animation {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 32px 0;
}

.ruleta-gif {
    max-width: 280px;
    border-radius: 16px;
    filter: drop-shadow(0 0 20px rgba(244,197,66,0.3));
}

.ruleta-resultado {
    margin-top: 20px;
}

.ruleta-error {
    color: #E53935;
    font-size: 0.9rem;
}

.ruleta-numeros-reveal {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.reveal-card {
    width: 80px;
    padding: 16px 8px;
    background: rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    text-align: center;
    opacity: 0;
    transform: scale(0.5) rotateY(180deg);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reveal-card.revealed {
    opacity: 1;
    transform: scale(1) rotateY(0deg);
}

.reveal-card.winner {
    border-color: #4CAF50;
    background: rgba(76,175,80,0.1);
    box-shadow: 0 0 16px rgba(76,175,80,0.2);
}

.reveal-number {
    display: block;
    font-size: 1.4rem;
    font-weight: 800;
    color: #F4C542;
    margin-bottom: 4px;
}

.reveal-card.winner .reveal-number {
    color: #4CAF50;
}

.reveal-status {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.4);
}

.reveal-card.winner .reveal-status {
    color: #4CAF50;
}

.rifa-select-loteria {
    display: block;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.4);
    margin-top: 4px;
}

.rifa-select-loteria i {
    color: #F4C542;
    margin-right: 4px;
}

/* ========== GRID DE BOLETOS ========== */
.boletos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.boletos-header h2 {
    font-size: 1.3rem;
}

.boletos-header h2 i {
    color: #F4C542;
    margin-right: 8px;
}

.boletos-legend {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
}

.legend-disponible { color: rgba(255,255,255,0.15); }
.legend-seleccionado { color: #F4C542; }
.legend-ocupado { color: #C8102E; }

.boletos-search {
    position: relative;
    margin-bottom: 20px;
}

.boletos-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.3);
}

.boletos-search input {
    width: 100%;
    padding: 12px 12px 12px 42px;
    background: rgba(26,26,26,0.8);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    color: #fff;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.boletos-search input:focus {
    border-color: rgba(244,197,66,0.4);
}

.boletos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 8px;
    max-height: 420px;
    overflow-y: auto;
    padding: 4px;
}

.boleto {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: rgba(255,255,255,0.6);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', monospace;
}

.boleto:hover:not(.ocupado):not(.selected) {
    border-color: rgba(244,197,66,0.4);
    background: rgba(244,197,66,0.08);
    color: #F4C542;
}

.boleto.selected {
    background: linear-gradient(135deg, #F4C542, #FFD700);
    color: #000;
    border-color: #F4C542;
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(244,197,66,0.3);
}

.boleto.ocupado {
    background: rgba(200,16,46,0.15);
    border-color: rgba(200,16,46,0.3);
    color: rgba(200,16,46,0.5);
    cursor: not-allowed;
}

/* ========== PANEL FIJO ========== */
.buy-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(244,197,66,0.2);
    padding: 16px 24px;
    z-index: 900;
    transform: translateY(100%);
    transition: transform 0.4s ease;
}

.buy-panel.visible {
    transform: translateY(0);
}

.buy-panel-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.buy-panel-summary {
    display: flex;
    gap: 20px;
    align-items: center;
}

.buy-panel-count {
    color: rgba(255,255,255,0.6);
    font-size: 0.95rem;
}

.buy-panel-total {
    color: #F4C542;
    font-size: 1.15rem;
    font-weight: 700;
}

/* ========== MODALES ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 24px;
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: #1A1A1A;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 32px;
    max-width: 440px;
    width: 100%;
    position: relative;
}

.modal h2 {
    font-size: 1.3rem;
    margin-bottom: 4px;
}

.modal h2 i {
    color: #F4C542;
    margin-right: 8px;
}

.modal-sub {
    color: rgba(255,255,255,0.45);
    font-size: 0.85rem;
    margin-bottom: 24px;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: #fff;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
    margin-bottom: 6px;
}

.form-group label i {
    margin-right: 6px;
    color: #F4C542;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    border-color: rgba(244,197,66,0.5);
}

.form-summary {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.6);
}

.form-total {
    color: #F4C542;
    font-weight: 700;
    font-size: 1.1rem;
    margin-top: 6px;
}

/* Resultado */
.result-success, .result-error {
    text-align: center;
    padding: 16px 0;
}

.result-success i, .result-error i {
    font-size: 3rem;
    margin-bottom: 16px;
}

.result-success i { color: #4CAF50; }
.result-error i { color: #E53935; }

.result-success h2, .result-error h2 {
    margin-bottom: 8px;
}

.result-total {
    color: #F4C542;
    font-size: 1.2rem;
    margin: 12px 0;
}

.result-note {
    color: rgba(255,255,255,0.45);
    font-size: 0.85rem;
    margin-bottom: 20px;
}

.result-note i {
    font-size: 0.85rem !important;
    margin-right: 4px;
    color: #F4C542 !important;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .buy-rifa-info {
        flex-direction: column;
        text-align: center;
    }

    .buy-rifa-img {
        width: 120px;
        height: 120px;
    }

    .buy-rifa-meta {
        justify-content: center;
    }

    .boletos-grid {
        grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    }

    .buy-panel-inner {
        flex-direction: column;
        text-align: center;
    }

    .buy-panel-summary {
        justify-content: center;
    }

    .boletos-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .ruleta-wrapper {
        width: 220px;
        height: 220px;
    }
}

@media (max-width: 480px) {
    .boletos-grid {
        grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
        gap: 6px;
    }

    .boleto {
        font-size: 0.7rem;
    }
}
