/* Rifa Manual V2 - Estilos específicos */

/* Importar estilos base da rifa automate (carrossel, seções, etc) */
@import url('rifa-automate-dark.css');
@import url('rifa-automate-light.css');

/* Sobrescrever/adicionar estilos específicos da manual */

/* Legendas - container */
.manual-legends {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 30px 0;
}

/* Legendas - estilo base */
.manual-legends .rifa_number.legend {
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 12px;
}

/* Grid de números */
#tbl-rifa.rifa_table_container {
    padding: 20px;
    padding-bottom: 3rem;
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center; /* Centraliza o grid */
}

#tbl-rifa.rifa_table_container .rifa_number {
    margin: 0;
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
}

/* Formatos de números - Square (Quadrado) */
body.square #tbl-rifa.rifa_table_container .rifa_number {
    width: 46px !important;
    height: 46px !important;
    border-radius: 3px !important;
}

/* Formatos de números - Retangle (Retangular) */
body.retangle #tbl-rifa.rifa_table_container .rifa_number {
    width: 46px !important;
    height: 36px !important;
    border-radius: 3px !important;
}

body.dark.retangle #tbl-rifa.rifa_table_container .rifa_number {
    border: none !important;
}

/* Legendas - formato padrão (circular) */
.manual-legends .rifa_number.legend {
    padding: 12px;
    border-radius: 25px;
    height: 40px;
}

/* Legendas para formatos square e retangle */
body.square .manual-legends .rifa_number.legend,
body.retangle .manual-legends .rifa_number.legend {
    padding: 6px !important;
    border-radius: 5px !important;
    height: auto !important;
}

/* Tooltip - centralizar texto */
.tooltip-content-flip > span {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px !important;
}

/* Mensagem de seleção manual no topo - GERAL (ambos os tipos) */
.manual-selection-message {
    margin-bottom: 1rem;
}

.manual-selection-message .form-title {
    margin-bottom: 0.25rem;
}

.manual-selection-message .form-subtitle {
    margin-bottom: 0;
}

/* Purchase Form Manual - Box interno de compra automática - GERAL (ambos os tipos) */
.automatic-purchase-box {
    border: 1px solid #e5e7eb !important;
    border-radius: 0.5rem !important;
    padding: 1.25rem !important;
    background: transparent !important;
    margin-top: auto !important;
    margin-bottom: 0.75rem !important;
}

/* Tema dark - mesma borda do purchase-form */
.dark .automatic-purchase-box {
    border-color: #374151 !important;
}

/* Type 1 (ao lado): Layout padrão vertical */
.purchase-form:not(.purchase-form-type-0) .automatic-purchase-box {
    display: flex;
    flex-direction: column;
}

.purchase-form:not(.purchase-form-type-0) .automatic-right {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

.purchase-form:not(.purchase-form-type-0) .controls-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    align-items: center;
    padding-top: 0.5rem;
}

/* Type 1: Centralizar controles de quantidade */
.purchase-form:not(.purchase-form-type-0) .quantity-controls {
    display: flex;
    justify-content: center;
}

/* Type 1: Botão COMPRAR ocupa 100% da largura */
.purchase-form:not(.purchase-form-type-0) .controls-row #btn-automatic-buy {
    width: 100%;
}

.purchase-form:not(.purchase-form-type-0) .controls-row .btn-buy {
    width: 100%;
    justify-content: center;
}

/* Type 1: Espaçamento no topo da mensagem "Escolha seus Números" */
.purchase-form:not(.purchase-form-type-0) .manual-selection-message {
    margin-top: 1.5rem;
    flex-shrink: 0;
}

/* Type 1: Box de compra automática empurrado para o final */
.purchase-form:not(.purchase-form-type-0) .automatic-purchase-box {
    margin-top: auto;
    margin-bottom: 1.5rem;
    flex-shrink: 0;
}

/* Type 1: Diminuir textos de Compra Automática (igual ao Type 0) */
.purchase-form:not(.purchase-form-type-0) .automatic-purchase-box .automatic-left .form-title {
    font-size: 0.95rem !important;
    font-weight: 600 !important;
}

.purchase-form:not(.purchase-form-type-0) .automatic-purchase-box .automatic-left .form-subtitle {
    font-size: 0.75rem !important;
    line-height: 1.3 !important;
    margin-bottom: 0.75rem !important;
}

/* Type 1: Sobrescrever para tema dark */
body.dark .purchase-form:not(.purchase-form-type-0) .automatic-purchase-box .automatic-left .form-title {
    font-size: 0.95rem !important;
}

body.dark .purchase-form:not(.purchase-form-type-0) .automatic-purchase-box .automatic-left .form-subtitle {
    font-size: 0.75rem !important;
}

/* Botão Ver Meus Números no fundo */
.btn-view-bottom {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    flex-shrink: 0;
}

/* Form content com flexbox para empurrar box e botão para o fundo */
.purchase-form-container .form-content {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    padding-bottom: 1.5rem !important;
}

/* Permitir que o purchase-form cresça quando necessário (quando tem date-lottery-header) */
@media (min-width: 768px) {
    .purchase-form-container:has(.date-lottery-header:not(.hidden)) {
        height: auto !important;
        min-height: 536px !important;
    }
    
    .purchase-form:has(.date-lottery-header:not(.hidden)) {
        height: auto !important;
        min-height: 536px !important;
    }
}

/* ===== AJUSTES PARA TYPE 0 (CAROUSEL EMBAIXO) ===== */

/* Type 0: Layout horizontal mais compacto */
.purchase-form-type-0 .form-content {
    min-height: auto !important;
    padding: 1.5rem !important;
    display: block !important;
}

/* Type 0: Mensagem manual centralizada e compacta */
.purchase-form-type-0 .manual-selection-message {
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Type 0: Box de compra automática - layout em linha única */
.purchase-form-type-0 .automatic-purchase-box {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2rem !important;
    padding: 1.25rem 2.5rem !important;
    margin-bottom: 1rem !important;
}

/* Type 0: Coluna esquerda (textos) - 50% da largura */
.purchase-form-type-0 .automatic-purchase-box .automatic-left {
    flex: 0 0 50%;
    max-width: 50%;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-right: 1rem;
}

/* Type 0: Coluna direita (controles) - 50% da largura, alinhado à esquerda */
.purchase-form-type-0 .automatic-purchase-box .automatic-right {
    flex: 0 0 50%;
    max-width: 50%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding-right: 0;
}

/* Type 0: Títulos alinhados à esquerda - seletores específicos */
.purchase-form-type-0 .automatic-purchase-box .automatic-left .form-title {
    text-align: left !important;
    font-size: 0.95rem !important;
    margin-top: 0 !important;
    margin-bottom: 0.25rem !important;
    font-weight: 600 !important;
}

.purchase-form-type-0 .automatic-purchase-box .automatic-left .form-subtitle {
    text-align: left !important;
    font-size: 0.75rem !important;
    margin-bottom: 0 !important;
    line-height: 1.3 !important;
}

/* Sobrescrever regras do rifa-automate-dark.css */
body.dark .purchase-form-type-0 .automatic-purchase-box .automatic-left .form-title {
    font-size: 0.95rem !important;
}

body.dark .purchase-form-type-0 .automatic-purchase-box .automatic-left .form-subtitle {
    font-size: 0.75rem !important;
}

/* Type 0: Quantity text */
.purchase-form-type-0 .quantity-text {
    font-size: 0.875rem;
    white-space: nowrap;
    margin-bottom: 0.5rem;
}

/* Type 0: Controls row - layout horizontal */
.purchase-form-type-0 .controls-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.purchase-form-type-0 .quantity-controls {
    flex-shrink: 0;
}

/* Type 0: Botão comprar ao lado dos controles */
.purchase-form-type-0 .controls-row #btn-automatic-buy {
    flex: 1;
}

.purchase-form-type-0 .controls-row .btn-buy {
    width: 100%;
    font-size: 0.875rem !important;
    height: 40px !important;
    padding: 0 1rem !important;
    box-sizing: border-box !important;
    justify-content: center !important;
}

.purchase-form-type-0 .controls-row .btn-buy .btn-content {
    margin: 0 auto;
}

/* Type 0: Esconder botão Ver Meus Números */
.purchase-form-type-0 .btn-view-bottom {
    display: none !important;
}

/* Responsivo: Mobile volta para layout vertical */
@media (max-width: 768px) {
    /* Box em coluna vertical */
    .purchase-form-type-0 .automatic-purchase-box {
        flex-direction: column !important;
        gap: 1.5rem !important;
        padding: 1.25rem 1.5rem !important;
    }
    
    /* Colunas ocupam 100% */
    .purchase-form-type-0 .automatic-purchase-box .automatic-left,
    .purchase-form-type-0 .automatic-purchase-box .automatic-right {
        flex: 1 1 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    
    /* Textos centralizados no mobile */
    .purchase-form-type-0 .automatic-purchase-box .automatic-left .form-title,
    .purchase-form-type-0 .automatic-purchase-box .automatic-left .form-subtitle {
        text-align: center !important;
    }
    
    /* Controls row em coluna no mobile */
    .purchase-form-type-0 .controls-row {
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    /* Botão comprar ocupa 100% no mobile */
    .purchase-form-type-0 .controls-row #btn-automatic-buy {
        width: 100%;
    }
    
    .purchase-form-type-0 .controls-row .btn-buy {
        width: 100% !important;
    }
}

.tooltip-back {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 8px !important;
}

/* `box_cart - sticky shopping cart at bottom */
.box_cart {
    min-height: 70px;
    z-index: 999999 !important;
    padding: 1rem 3rem;
    position: sticky;
    bottom: 0;
    margin-bottom: 4rem;
    background-color: #fff;
    border-top: 2px solid #d1d5db;
    border-bottom: 2px solid #d1d5db;
    color: #000;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
    width: 100%;
    display: block;
}

/* Espaçamento abaixo da barra */
.box_cart + * {
    margin-top: 4rem !important;
}

.box_cart .cart {
    align-items: center;
    padding: 1.5rem 2.5rem;
}

.box_cart .cart .cart-numbers {
    border-bottom: none;
    margin-bottom: 15px;
    padding-bottom: 15px;
    padding-right: 10px;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 120px;
}

/* Scrollbar tema light */
.box_cart .cart .cart-numbers::-webkit-scrollbar {
    width: 8px;
}

.box_cart .cart .cart-numbers::-webkit-scrollbar-track {
    background: #e5e7eb;
    border-radius: 4px;
}

.box_cart .cart .cart-numbers::-webkit-scrollbar-thumb {
    background: #6b7280;
    border-radius: 4px;
}

.box_cart .cart .cart-numbers::-webkit-scrollbar-thumb:hover {
    background: #4b5563;
}

.box_cart .cart .cart-numbers span {
    margin: 5px 5px 5px 0px;
    padding: 3px 5px;
    border: 1px solid #000000;
    border-radius: 3px;
    background-color: #fff;
    color: #000;
    display: inline-block;
    font-weight: 500;
}

.box_cart .cart .cart-numbers span i {
    cursor: pointer;
    margin-left: 5px;
}

.box_cart .cart .cart-total {
    text-align: left;
    min-width: 40%;
    padding-left: 15px;
}

.box_cart .cart .cart-btn {
    text-align: center;
    padding: 1rem;
    min-width: 50%;
}

.box_cart .cart .cart-promotional .from span {
    text-decoration: line-through
}

.box_cart .cart .cart-promotional .total span {
    font-size: 1.2rem;
    font-weight: bold;
}

.box_cart.hidden {
    display: none !important;
}

/* Tema dark */
.tpl-dark .box_cart,
.dark .box_cart {
    background-color: #111827 !important;
    border-top: 2px solid #374151 !important;
    border-bottom: 2px solid #374151 !important;
}

.dark .box_cart .cart .cart-numbers span {
    background-color: #2a2a2a !important;
    color: #fff !important;
    border-color: #444 !important;
}

.dark .box_cart .cart-qtd,
.dark .box_cart .cart-qtd span,
.dark .box_cart .cart-qtd small,
.dark .box_cart .cart-promotional,
.dark .box_cart .cart-promotional small,
.dark .box_cart .cart-promotional span {
    color: #fff !important;
}

.tpl-dark .box_cart .cart-qtd,
.tpl-dark .box_cart .cart-qtd span,
.tpl-dark .box_cart .cart-qtd small,
.tpl-dark .box_cart .cart-promotional,
.tpl-dark .box_cart .cart-promotional small,
.tpl-dark .box_cart .cart-promotional span {
    color: #fff !important;
}

/* Scrollbar tema dark */
.dark .box_cart .cart .cart-numbers::-webkit-scrollbar,
.tpl-dark .box_cart .cart .cart-numbers::-webkit-scrollbar {
    width: 8px;
}

.dark .box_cart .cart .cart-numbers::-webkit-scrollbar-track,
.tpl-dark .box_cart .cart .cart-numbers::-webkit-scrollbar-track {
    background: #374151;
    border-radius: 4px;
}

.dark .box_cart .cart .cart-numbers::-webkit-scrollbar-thumb,
.tpl-dark .box_cart .cart .cart-numbers::-webkit-scrollbar-thumb {
    background: #9ca3af;
    border-radius: 4px;
}

.dark .box_cart .cart .cart-numbers::-webkit-scrollbar-thumb:hover,
.tpl-dark .box_cart .cart .cart-numbers::-webkit-scrollbar-thumb:hover {
    background: #d1d5db;
}

/* Mobile responsivo */
@media only screen and (max-width: 480px) {
    .box_cart .cart .cart-numbers {
        border-bottom: 1px solid #CCC;
        max-height: 95px;
    }
    
    .box_cart {
        padding: 1rem 1.5rem !important;
    }
}

/* FORÇA MÁXIMA - Garantir que a barra fique por cima de TUDO */
.rifa-automate-page .box_cart,
.box_cart {
    z-index: 999 !important;
    position: sticky !important;
    bottom: 0 !important;
    background-color: #fff !important;
}

.dark .box_cart,
.tpl-dark .box_cart {
    background-color: #111827 !important;
    border-top: 2px solid #374151 !important;
    border-bottom: 2px solid #374151 !important;
}

/* Garantir texto branco no dark */
.dark .box_cart *,
.tpl-dark .box_cart * {
    color: #fff !important;
}

.dark .box_cart .cart .cart-numbers span,
.tpl-dark .box_cart .cart .cart-numbers span {
    background-color: #2a2a2a !important;
    border-color: #444 !important;
}