/* ===== VARIÁVEIS CSS ===== */
:root {
    --primary-color: #007bff;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --light-gray: #f8f9fa;
    --border-color: #dee2e6;
    --text-dark: #333;
    --text-muted: #6c757d;
    --shadow-light: 0 4px 20px rgba(0,0,0,0.1);
    --shadow-medium: 0 10px 30px rgba(0,0,0,0.15);
    --border-radius: 15px;
    --border-radius-small: 10px;
    --transition: all 0.3s ease;
}

/* ===== ESTILOS GERAIS ===== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--light-gray);
    line-height: 1.6;
}

/* ===== HERO SECTION ===== */
.page-hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--info-color) 100%);
    color: white;
    padding: 3rem 0;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.page-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="hero-pattern" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23hero-pattern)"/></svg>');
    opacity: 0.3;
}

.page-content-wrapper {
    position: relative;
    z-index: 2;
}

/* ===== BREADCRUMB ===== */
.breadcrumb-custom {
    background: none;
    padding: 0;
    margin-bottom: 1rem;
}

.breadcrumb-custom a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: var(--transition);
}

.breadcrumb-custom a:hover {
    color: white;
    text-decoration: underline;
}

/* ===== CARDS E CONTAINERS ===== */
.cart-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    border: none;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.cart-header {
    background: linear-gradient(45deg, var(--primary-color), var(--info-color));
    color: white;
    padding: 1.5rem;
    margin: 0;
    border-bottom: none;
}

.cart-body {
    padding: 0;
}

/* ===== SEÇÃO DE PAGAMENTO ===== */
.payment-section {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    padding: 2rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* ===== MÉTODOS DE PAGAMENTO - CORRIGIDO ===== */
.payment-method {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
    background: white;
    transition: var(--transition);
    position: relative;
    /* Permitir interação com elementos filhos */
    pointer-events: auto;
}

.payment-method:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 10px rgba(0,123,255,0.1);
    transform: translateY(-1px);
}

.payment-method.selected {
    border-color: var(--primary-color) !important;
    background: rgba(0,123,255,0.05) !important;
    box-shadow: 0 4px 15px rgba(0,123,255,0.15) !important;
}

.payment-method.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f8f9fa;
}

.payment-method.disabled:hover {
    transform: none;
    box-shadow: none;
}

.method-icon {
    font-size: 2rem;
    margin-right: 1rem;
}

/* Radio button - corrigido */
.payment-method input[type="radio"] {
    position: absolute;
    right: 1rem;
    top: 1rem;
    width: 20px;
    height: 20px;
    opacity: 1;
    z-index: 3;
    cursor: pointer;
    /* Garantir que o radio funcione */
    pointer-events: auto !important;
}

/* ===== DETALHES DO PAGAMENTO - TOTALMENTE CORRIGIDO ===== */
.payment-details {
    /* Estado inicial - oculto */
    display: none;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s ease;
    /* Permitir interação com inputs */
    pointer-events: auto;
}

/* Estado ativo dos detalhes - CRÍTICO */
.payment-details.active {
    display: block !important;
    opacity: 1 !important;
    max-height: none !important;
    overflow: visible !important;
    pointer-events: auto !important;
}

/* Garantir que TODOS os elementos dentro dos detalhes ativos sejam interativos */
.payment-details.active * {
    pointer-events: auto !important;
}

/* Corrigir especificamente os inputs */
.payment-details input,
.payment-details select,
.payment-details textarea,
.payment-details button,
.payment-details label {
    pointer-events: auto !important;
    user-select: auto !important;
    -webkit-user-select: auto !important;
    -moz-user-select: auto !important;
    -ms-user-select: auto !important;
}

/* Estado de foco dos inputs */
.payment-details input:focus,
.payment-details select:focus,
.payment-details textarea:focus {
    outline: 2px solid var(--primary-color) !important;
    outline-offset: 2px !important;
    pointer-events: auto !important;
}

/* ===== FORMULÁRIOS - CORRIGIDO ===== */
.form-floating {
    margin-bottom: 1rem;
    position: relative;
    /* Garantir interatividade */
    pointer-events: auto;
}

.form-floating label {
    color: var(--text-muted);
    pointer-events: none; /* Labels não devem interceptar cliques */
}

.form-floating .form-control:focus ~ label,
.form-floating .form-select:focus ~ label {
    color: var(--primary-color);
}

.form-control,
.form-select {
    border-radius: var(--border-radius-small);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    /* CRÍTICO - garantir que inputs sejam clicáveis */
    pointer-events: auto !important;
    user-select: auto !important;
    -webkit-user-select: auto !important;
    background: white !important;
    z-index: 2;
    position: relative;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(0, 123, 255, 0.15);
    pointer-events: auto !important;
}

.form-control.is-valid {
    border-color: var(--success-color);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
}

.invalid-feedback {
    display: block;
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* ===== BOTÕES ===== */
.btn-payment {
    background: linear-gradient(45deg, var(--success-color), #20c997);
    border: none;
    color: white;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: var(--border-radius-small);
    width: 100%;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    pointer-events: auto !important;
}

.btn-payment::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: var(--transition);
}

.btn-payment:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40,167,69,0.3);
}

.btn-payment:hover::before {
    left: 100%;
}

.btn-payment:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-payment:disabled::before {
    display: none;
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.loading-content {
    background: white;
    padding: 3rem;
    border-radius: var(--border-radius);
    text-align: center;
    max-width: 400px;
    box-shadow: var(--shadow-medium);
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== ALERTAS CUSTOMIZADOS ===== */
.alert-custom {
    border: none;
    border-radius: var(--border-radius-small);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-light);
}

.alert-custom-notification {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== CARRINHO VAZIO ===== */
.empty-cart {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
}

.empty-cart i {
    font-size: 5rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    opacity: 0.7;
}

.empty-cart h3 {
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.empty-cart .btn {
    padding: 0.875rem 2rem;
    font-weight: 600;
}

/* ===== ITENS DO PRODUTO ===== */
.product-item {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.product-item:hover {
    background: rgba(0,123,255,0.02);
    transform: translateX(5px);
}

.product-item:last-child {
    border-bottom: none;
}

.product-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--border-radius-small);
    margin-right: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: var(--transition);
}

.product-image:hover {
    transform: scale(1.05);
}

.product-info {
    flex: 1;
}

.product-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-size: 1.1rem;
}

.product-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--success-color);
}

.product-price-original {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: 1rem;
    margin-right: 0.5rem;
    font-weight: normal;
}

.product-actions .btn {
    transition: var(--transition);
}

.product-actions .btn:hover {
    transform: scale(1.1);
}

/* ===== RESUMO DO PEDIDO ===== */
.order-summary {
    background: var(--light-gray);
    border-radius: var(--border-radius-small);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.95rem;
}

.summary-row.total {
    border-top: 2px solid var(--border-color);
    padding-top: 1rem;
    margin-top: 1rem;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-dark);
}

/* ===== SEÇÃO DE CUPOM ===== */
.cupom-section {
    background: white;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-small);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.cupom-section:hover {
    border-color: var(--primary-color);
}

.cupom-applied {
    background: rgba(40,167,69,0.1);
    border-color: var(--success-color);
    border-style: solid;
}

.cupom-section h6 {
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.input-group .btn {
    border-radius: 0 var(--border-radius-small) var(--border-radius-small) 0;
}

.input-group .form-control {
    border-radius: var(--border-radius-small) 0 0 var(--border-radius-small);
}

/* ===== ESTADOS DE LOADING ===== */
.form-control.loading {
    position: relative;
    background-image: url("data:image/svg+xml,%3csvg width='20' height='20' viewBox='0 0 50 50' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M25,5A20.14,20.14,0,0,1,45,22.88a2.51,2.51,0,0,0,2.49,2.26h0A2.52,2.52,0,0,0,50,22.33a25.14,25.14,0,0,0-50,2.67,2.52,2.52,0,0,0,2.5,2.81h0A2.51,2.51,0,0,0,5,25' fill='%23007bff'%3e%3canimateTransform attributeName='transform' type='rotate' values='0 25 25;360 25 25' dur='2s' repeatCount='indefinite'/%3e%3c/path%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

/* ===== BADGES E LABELS ===== */
.badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
    border-radius: 20px;
}

/* ===== CORREÇÕES ESPECÍFICAS PARA INTERATIVIDADE ===== */

/* Garantir que divs não bloqueiem inputs */
.payment-method > div {
    pointer-events: none;
}

.payment-method > div * {
    pointer-events: auto;
}

/* Input groups */
.input-group {
    pointer-events: auto;
}

.input-group * {
    pointer-events: auto !important;
}

/* Botões dentro de forms */
button, .btn {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 768px) {
    .page-hero {
        padding: 2rem 0;
    }

    .page-hero .display-4 {
        font-size: 2rem;
    }

    .product-item {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }

    .product-image {
        margin-right: 0;
        margin-bottom: 1rem;
        width: 120px;
        height: 120px;
    }

    .payment-method {
        padding: 1rem;
    }

    .payment-section {
        padding: 1rem;
        margin: 0 -15px;
        border-radius: 0;
    }

    .cart-card {
        margin: 0 -15px 1.5rem;
        border-radius: 0;
    }

    .cupom-section {
        margin: 0 -15px 1.5rem;
        border-radius: 0;
    }

    .method-icon {
        font-size: 1.5rem;
        margin-right: 0.5rem;
    }

    .btn-payment {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }

    .loading-content {
        padding: 2rem;
        margin: 0 1rem;
    }

    .form-floating {
        margin-bottom: 0.75rem;
    }

    .order-summary {
        padding: 1rem;
    }

    .payment-method input[type="radio"] {
        right: 0.5rem;
    }
}

@media (max-width: 576px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    .page-hero {
        margin-bottom: 1rem;
    }

    .summary-row {
        font-size: 0.9rem;
    }

    .summary-row.total {
        font-size: 1.1rem;
    }

    .product-title {
        font-size: 1rem;
    }

    .product-price {
        font-size: 1.1rem;
    }

    .alert-custom-notification {
        left: 10px !important;
        right: 10px !important;
        max-width: calc(100% - 20px) !important;
        transform: none !important;
    }
}

/* ===== MELHORIAS DE ACESSIBILIDADE ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== FOCUS STYLES ===== */
.form-control:focus,
.form-select:focus,
.btn:focus,
.payment-method:focus-within {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.payment-method:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* ===== PRINT STYLES ===== */
@media print {
    .loading-overlay,
    .btn,
    .alert {
        display: none !important;
    }

    .cart-card,
    .payment-section {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .payment-method {
        border: 1px solid #ccc;
    }

    .page-hero {
        background: none;
        color: black;
    }
}