/* Reset e configurações base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

:root {
    /* Cores principais - Tema NV Checkout */
    --primary: #0F4C5C;
    --primary-dark: #0F4C5C;
    --secondary: #56C596;
    --accent: #4ECDC4;
    --success: #56C596;
    --warning: #F59E0B;
    --danger: #E74C3C;
    
    /* Tons de neutros */
    --white: #FFFFFF;
    --light: #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    --gray-900: #0F172A;
    --black: #000000;
    
    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    --gradient-secondary: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
    --gradient-dark: linear-gradient(135deg, var(--gray-800) 0%, var(--gray-900) 100%);
    
    /* Tema Claro - NV Checkout */
    --bg-primary: #F7F9FB;
    --bg-surface: var(--white);
    --text-primary: var(--primary);
    --text-secondary: #666666;
    --border: #CCCCCC;
    --shadow: rgba(15, 76, 92, 0.08);
    --shadow-hover: rgba(15, 76, 92, 0.12);
    
    /* Efeitos de glassmorfismo */
    --glass: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] {
    --bg-primary: #0A2D38;
    --bg-surface: #0F4C5C;
    --text-primary: var(--white);
    --text-secondary: #888888;
    --border: #444444;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(0, 0, 0, 0.4);
    --glass: rgba(15, 76, 92, 0.5);
    --glass-border: rgba(78, 236, 196, 0.2);
}

body.dark-theme {
    background: linear-gradient(135deg, #0A2D38 0%, #152F38 100%);
    color: #FFFFFF;
}

body.dark-theme .checkout-card {
    background: rgba(15, 76, 92, 0.95);
    border: 1px solid rgba(86, 197, 150, 0.2);
}

body.dark-theme input {
    background: rgba(30, 30, 30, 0.8);
    color: #FFFFFF;
    border-color: #45A57D;
}

body.dark-theme .product-title,
body.dark-theme .section-title,
body.dark-theme label {
    color: #4ECDC4;
}

body.dark-theme .product-price {
    color: #45A57D;
}

body.dark-theme .footer {
    background: linear-gradient(135deg, rgba(15, 76, 92, 0.2), rgba(69, 165, 125, 0.1));
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px 10px;
    transition: all 0.3s ease;
    font-weight: 400;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding-top: 80px;
    position: relative;
}

/* Countdown Container */
.countdown-container {
    background: var(--danger);
    color: var(--white);
    padding: clamp(12px, 3vw, 16px);
    border-radius: 20px;
    margin-bottom: 25px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(58, 134, 255, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    animation: countdown-glow 2s ease-in-out infinite alternate;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 760px;
    z-index: 999;
    overflow: hidden;
}

.countdown-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 3s linear infinite;
}

@keyframes countdown-glow {
    0% { 
        box-shadow: 0 10px 30px rgba(58, 134, 255, 0.4);
        transform: translateX(-50%) scale(1);
    }
    100% { 
        box-shadow: 0 15px 40px rgba(58, 134, 255, 0.6);
        transform: translateX(-50%) scale(1.02);
    }
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%); }
    100% { transform: translateX(100%) translateY(100%); }
}

.countdown-text {
    font-weight: 500;
    font-size: clamp(12px, 2.8vw, 14px);
    z-index: 2;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

.countdown-timer {
    font-weight: 700;
    font-size: clamp(13px, 2.8vw, 16px);
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 2;
    position: relative;
    white-space: nowrap;
}

/* Header branding */
.brand-header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.brand-logo {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.brand-tagline {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
}

/* Card principal */
.checkout-card {
    background: var(--bg-surface);
    border-radius: 25px;
    box-shadow: 0 20px 60px var(--shadow);
    overflow: hidden;
    margin-bottom: 30px;
    border: 1px solid var(--border);
    position: relative;
    transition: all 0.3s ease;
}

.checkout-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    background-size: 200% 100%;
    animation: gradient-move 3s ease infinite;
}

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

/* Seção do produto - SEMPRE com imagem ao lado */
.product-section {
    display: flex;
    padding: clamp(20px, 4vw, 30px);
    border-bottom: 1px solid var(--border);
    gap: clamp(15px, 4vw, 25px);
    align-items: flex-start;
    flex-direction: row;
}

.product-loading {
    text-align: center;
    padding: 40px;
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.product-image {
    width: 120px;
    height: 120px;
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    box-shadow: 0 8px 25px var(--shadow);
    position: relative;
    flex-shrink: 0;
}

[data-theme="dark"] .product-image {
    background: linear-gradient(135deg, var(--gray-700) 0%, var(--gray-800) 100%);
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 20px;
}

.product-image::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    animation: image-shine 4s ease-in-out infinite;
}

@keyframes image-shine {
    0%, 100% { opacity: 0; transform: translateX(-100%); }
    50% { opacity: 1; transform: translateX(100%); }
}

.product-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.product-title {
    font-size: clamp(18px, 4vw, 22px);
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
    line-height: 1.3;
}

.product-description {
    color: var(--text-secondary);
    margin-bottom: 15px;
    font-size: clamp(13px, 3vw, 15px);
    line-height: 1.5;
}

.product-price {
    font-size: clamp(20px, 5vw, 26px);
    font-weight: 800;
    color: var(--primary);
    text-shadow: 0 2px 4px rgba(58, 134, 255, 0.2);
    margin-top: auto;
}

/* Seção de formulário */
.form-section {
    padding: clamp(20px, 4vw, 30px);
}

.section-title {
    font-size: clamp(16px, 3.5vw, 18px);
    font-weight: 700;
    margin-bottom: 25px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding-bottom: 10px;
    text-align: center;
}

.section-title i {
    margin-right: 12px;
    padding: 8px;
    background: var(--gradient-primary);
    border-radius: 10px;
    color: var(--white);
    font-size: 14px;
}

.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: clamp(13px, 3vw, 15px);
}

input {
    width: 100%;
    padding: clamp(14px, 3vw, 16px);
    border: 2px solid var(--border);
    border-radius: 15px;
    font-size: clamp(13px, 3vw, 15px);
    background: var(--bg-surface);
    color: var(--text-primary);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--shadow);
    height: clamp(48px, 10vw, 52px);
}

input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 4px rgba(58, 134, 255, 0.1), 0 8px 25px var(--shadow);
    transform: translateY(-1px);
}

/* Input de telefone melhorado */
.phone-input-with-flag {
    display: flex;
    align-items: center;
    border: 2px solid var(--border);
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    background: var(--bg-surface);
    box-shadow: 0 4px 15px var(--shadow);
}

.phone-input-with-flag:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(58, 134, 255, 0.1), 0 8px 25px var(--shadow);
    transform: translateY(-1px);
}

.flag-container {
    padding: clamp(14px, 3vw, 16px);
    padding-right: 8px;
    display: flex;
    align-items: center;
    background: var(--gray-100);
    border-right: 1px solid var(--border);
}

[data-theme="dark"] .flag-container {
    background: var(--gray-700);
}

.flag {
    width: 24px;
    height: 16px;
    border-radius: 3px;
    background-size: cover;
    background-position: center;
    box-shadow: 0 2px 6px var(--shadow);
}

.flag.mz {
    background: linear-gradient(to bottom, #009639 33%, #ffffff 33% 66%, #ffcc00 66%);
}

.phone-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: clamp(14px, 3vw, 16px);
    padding-left: 8px;
    font-size: clamp(13px, 3vw, 15px);
    color: var(--text-primary);
    outline: none;
    height: clamp(48px, 10vw, 52px);
}

/* Métodos de pagamento - SEMPRE lado a lado */
.payment-methods {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    justify-content: center;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    flex-wrap: nowrap;
}

.payment-method {
    flex: 1;
    min-width: 0;
    max-width: 160px;
    border: 2px solid var(--border);
    border-radius: 20px;
    padding: clamp(10px, 3vw, 15px) clamp(5px, 2vw, 10px);
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-surface);
    position: relative;
    overflow: hidden;
}

.payment-method::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(58, 134, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.payment-method:hover {
    border-color: var(--primary);
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px var(--shadow-hover);
}

.payment-method:hover::before {
    left: 100%;
}

.payment-method.selected {
    border-color: var(--primary);
    background: rgba(58, 134, 255, 0.05);
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 20px 50px rgba(58, 134, 255, 0.2);
}

.payment-logo {
    width: 60px;
    height: 45px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    position: relative;
}

.payment-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.payment-name {
    font-weight: 700;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--text-primary);
    z-index: 2;
    position: relative;
}

.payment-desc {
    font-size: 11px;
    color: var(--text-secondary);
    z-index: 2;
    position: relative;
}

/* Modal de seleção de método de pagamento */
.modal-payment-methods {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
    flex-wrap: nowrap;
}

.modal-payment-method {
    flex: 1;
    min-width: 0;
    max-width: 160px;
    border: 2px solid var(--border);
    border-radius: 20px;
    padding: clamp(10px, 3vw, 15px) clamp(5px, 2vw, 10px);
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-surface);
    position: relative;
    overflow: hidden;
}

.modal-payment-method:hover {
    border-color: var(--primary);
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px var(--shadow-hover);
}

.modal-payment-method.selected {
    border-color: var(--primary);
    background: rgba(58, 134, 255, 0.05);
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 20px 50px rgba(58, 134, 255, 0.2);
}

/* Botão de checkout */
.checkout-btn {
    width: 100%;
    padding: clamp(16px, 3.5vw, 18px);
    background: var(--gradient-primary);
    color: var(--white);
    border: none;
    border-radius: 15px;
    font-size: clamp(14px, 3.5vw, 16px);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(58, 134, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.checkout-btn::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: left 0.5s ease;
}

.checkout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(58, 134, 255, 0.4);
}

.checkout-btn:hover::before {
    left: 100%;
}

.checkout-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Modal de pagamento */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-surface);
    border-radius: 20px;
    padding: 30px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    position: relative;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    gap: 15px;
}

.modal-logo {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    background: var(--gradient-primary);
    color: white;
    font-size: 24px;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--gray-100);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

[data-theme="dark"] .modal-close {
    background: var(--gray-700);
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--text-primary);
}

[data-theme="dark"] .modal-close:hover {
    background: var(--gray-600);
}

.modal-text {
    margin-bottom: 20px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.modal-btn {
    flex: 1;
    padding: 14px;
    border-radius: 15px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn.cancel {
    background: var(--gray-100);
    color: var(--text-secondary);
}

[data-theme="dark"] .modal-btn.cancel {
    background: var(--gray-700);
}

.modal-btn.cancel:hover {
    background: var(--gray-200);
}

[data-theme="dark"] .modal-btn.cancel:hover {
    background: var(--gray-600);
}

.modal-btn.confirm {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(58, 134, 255, 0.3);
}

.modal-btn.confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(58, 134, 255, 0.4);
}

/* Estados de erro */
.error {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1) !important;
}

.error-message {
    color: var(--danger);
    font-size: 12px;
    margin-top: 5px;
    display: none;
}

.error-message.show {
    display: block;
}

/* Alert Styles */
.alert {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
}

.alert.success {
    background: #f0fff4;
    border-left: 4px solid #48bb78;
    color: #22543d;
}

.alert.error {
    background: #fed7d7;
    border-left: 4px solid #f56565;
    color: #742a2a;
}

.alert.warning {
    background: #fefcbf;
    border-left: 4px solid #ed8936;
    color: #7c2d12;
}

.alert-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
}

.alert-message {
    flex: 1;
    margin-right: 15px;
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.alert-close:hover {
    opacity: 1;
}

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

/* Responsividade - Garantir que os métodos de pagamento sempre fiquem lado a lado */
@media (max-width: 768px) {
    .countdown-container {
        top: 15px;
        width: calc(100% - 30px);
        padding: clamp(10px, 2.5vw, 16px);
    }
    
    .payment-methods,
    .modal-payment-methods {
        flex-wrap: nowrap;
        gap: 10px;
    }
    
    .payment-method,
    .modal-payment-method {
        max-width: 140px;
        padding: 10px 8px;
    }

    .modal-content {
        padding: 20px;
    }

    .modal-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .countdown-container {
        top: 12px;
        width: calc(100% - 20px);
        border-radius: 15px;
    }
    
    .container {
        padding: 10px 5px;
        padding-top: 80px;
    }

    /* Garantir que a imagem do produto sempre fique ao lado */
    .product-section {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
    }

    .product-image {
        margin-bottom: 0;
        margin-right: 15px;
    }

    .payment-methods,
    .modal-payment-methods {
        gap: 8px;
    }

    .payment-method,
    .modal-payment-method {
        max-width: 120px;
        padding: 8px 6px;
    }

    .payment-name,
    .modal-payment-method .payment-name {
        font-size: 12px;
    }

    .payment-desc,
    .modal-payment-method .payment-desc {
        font-size: 10px;
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
}

/* Copyright Footer */
.copyright-footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 40px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.copyright-footer p {
    margin: 5px 0;
}

.copyright-footer p:first-child {
    font-weight: 600;
    color: var(--text-primary);
}

/* Manter compatibilidade com elementos antigos */
.btn-primary {
    width: 100%;
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(58, 134, 255, 0.3);
}

.btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner-small {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #fff;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 8px;
}