/* =============================================================================
   cupom.css - Estilos do Cupom para Checkout CloudNota
   ============================================================================= */

/* ===== SEÇÃO DE CUPOM ===== */
.cupom-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed #e2e8f0;
}

.cupom-section.hidden {
    display: none;
}

.cupom-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    cursor: pointer;
    user-select: none;
}

.cupom-header i.bi-tag {
    color: #f59e0b;
    font-size: 1.1rem;
}

.cupom-header span {
    font-weight: 500;
    color: #4a5568;
    font-size: 0.9rem;
}

.cupom-header .toggle-icon {
    margin-left: auto;
    color: #a0aec0;
    transition: transform 0.2s ease;
}

.cupom-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

/* ===== FORMULÁRIO ===== */
.cupom-form {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.cupom-form.hidden {
    display: none;
}

.cupom-input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.cupom-input:focus {
    outline: none;
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.cupom-input::placeholder {
    text-transform: none;
    color: #a0aec0;
}

.cupom-input.is-valid {
    border-color: #10b981;
    background: #f0fdf4;
}

.cupom-input.is-invalid {
    border-color: #ef4444;
    background: #fef2f2;
}

.cupom-input:disabled {
    background: #f7fafc;
    cursor: not-allowed;
}

/* ===== BOTÃO ===== */
.btn-cupom {
    padding: 10px 16px;
    background: linear-gradient(135deg, #4361ee 0%, #3a51d4 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 80px;
}

.btn-cupom:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

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

.btn-cupom.loading {
    position: relative;
    color: transparent;
}

.btn-cupom.loading::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    top: 50%;
    left: 50%;
    margin: -7px 0 0 -7px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ===== RESULTADO ===== */
.cupom-resultado {
    display: none;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.cupom-resultado.show {
    display: flex;
}

.cupom-resultado.sucesso {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.cupom-resultado.erro {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.cupom-resultado .cupom-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    flex-wrap: wrap;
}

.cupom-resultado .cupom-codigo {
    font-weight: 700;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.cupom-resultado .cupom-desconto-valor {
    font-weight: 700;
    margin-left: auto;
}

.btn-remover-cupom {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remover-cupom:hover {
    opacity: 1;
}

/* ===== RESUMO COM DESCONTO ===== */
.summary-row.subtotal {
    color: #94a3b8;
    font-size: 0.85rem;
}

.summary-row.subtotal .valor-riscado {
    text-decoration: line-through;
}

.summary-row.desconto {
    color: #10b981;
}

.summary-row.desconto strong {
    font-weight: 700;
}

.summary-total.com-desconto .summary-total-value {
    color: #10b981;
}

/* ===== RESPONSIVO ===== */
@media (max-width: 480px) {
    .cupom-form {
        flex-direction: column;
    }
    
    .btn-cupom {
        width: 100%;
    }
    
    .cupom-resultado .cupom-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .cupom-resultado .cupom-desconto-valor {
        margin-left: 0;
    }
}