/**
 * Estilos para Sistema de Compra
 * Notificações, Modal de Boleto e Melhorias de UX
 */

/* ========================================
   NOTIFICATION TOAST
   ======================================== */
.notification-toast {
    position: fixed;
    top: -100px;
    right: 20px;
    background: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    transition: all 0.3s ease;
    max-width: 400px;
    font-size: 14px;
    border-left: 4px solid #007bff;
}

.notification-toast.show {
    top: 20px;
}

.notification-toast i {
    font-size: 20px;
}

.notification-toast.notification-success {
    border-left-color: #28a745;
}

.notification-toast.notification-success i {
    color: #28a745;
}

.notification-toast.notification-error {
    border-left-color: #dc3545;
}

.notification-toast.notification-error i {
    color: #dc3545;
}

.notification-toast.notification-info {
    border-left-color: #007bff;
}

.notification-toast.notification-info i {
    color: #007bff;
}

/* ========================================
   BOLETO MODAL
   ======================================== */
.boleto-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.boleto-modal.show {
    opacity: 1;
}

.boleto-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 750px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.boleto-modal.show .boleto-modal-content {
    transform: translateY(0);
}

.boleto-modal-header {
    padding: 30px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
}

.boleto-modal-header .success-icon {
    font-size: 64px;
    color: #28a745;
    margin-bottom: 16px;
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.boleto-modal-header h2 {
    margin: 0;
    font-size: 24px;
    color: #333;
}

.boleto-modal-body {
    padding: 30px;
}

.boleto-modal-body > p {
    margin-bottom: 20px;
    color: #666;
    line-height: 1.6;
}

.boleto-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.boleto-info .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.boleto-info .info-row:not(:last-child) {
    border-bottom: 1px solid #e0e0e0;
}

.boleto-info .label {
    font-weight: 600;
    color: #333;
}

.boleto-info .value {
    font-size: 18px;
    color: #007bff;
    font-weight: 600;
}

.boleto-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #e7f3ff;
    padding: 12px;
    border-radius: 6px;
    font-size: 13px;
    color: #0056b3;
    margin: 0;
}

.boleto-note i {
    margin-top: 2px;
    flex-shrink: 0;
}

.boleto-modal-footer {
    padding: 20px 30px;
    display: flex;
    gap: 12px;
    border-top: 1px solid #e0e0e0;
}

.btn-boleto-view {
    flex: 1;
    padding: 14px 24px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-boleto-view:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.btn-boleto-close {
    padding: 14px 24px;
    background: transparent;
    color: #666;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-boleto-close:hover {
    border-color: #999;
    color: #333;
}

/* ========================================
   BUTTON LOADING STATE
   ======================================== */
.btn-submit-purchase:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-submit-purchase:disabled:hover {
    transform: none;
}

/* ========================================
   COUPON APPLIED STATE
   ======================================== */
.btn-apply-coupon.applied {
    background: #28a745;
    cursor: default;
}

.btn-apply-coupon.applied:hover {
    background: #28a745;
}

/* ========================================
   FORM VALIDATION FEEDBACK
   ======================================== */
.form-control.error {
    border-color: #dc3545;
}

.form-control.success {
    border-color: #28a745;
}

.field-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

.field-success {
    color: #28a745;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */
@media (max-width: 768px) {
    .notification-toast {
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .notification-toast.show {
        top: 10px;
    }

    .boleto-modal-content {
        margin: 20px;
    }

    .boleto-modal-header {
        padding: 20px;
    }

    .boleto-modal-header .success-icon {
        font-size: 48px;
    }

    .boleto-modal-header h2 {
        font-size: 20px;
    }

    .boleto-modal-body {
        padding: 20px;
    }

    .boleto-modal-footer {
        flex-direction: column;
        padding: 15px 20px;
    }

    .btn-boleto-view,
    .btn-boleto-close {
        width: 100%;
    }
}

/* ========================================
   LOADING SPINNER
   ======================================== */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fa-spinner.fa-spin {
    animation: spin 1s linear infinite;
}

/* ========================================
   COUPON MESSAGE STYLES
   ======================================== */
.coupon-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-top: 12px;
    font-size: 14px;
    display: none;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.coupon-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.coupon-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.coupon-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ========================================
   TERMS MODAL (rolagem obrigatória)
   ======================================== */
.terms-link {
    background: none;
    border: 0;
    color: #007bff;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font: inherit;
}

.terms-modal {
    position: fixed;
    inset: 0;
    display: none; /* exibido somente com .show */
    align-items: center;
    justify-content: center;
    z-index: 10050;
}

.terms-modal.show { display: flex; }

.terms-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.terms-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: min(920px, 96vw);
    max-height: 90vh;
    box-shadow: 0 10px 40px rgba(0,0,0,.25);
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.terms-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}
.terms-modal-header h3 { margin: 0; font-size: 18px; color: #111827; display:flex; align-items:center; gap:8px; }
.terms-modal-close { background: transparent; border: 0; cursor: pointer; color: #6b7280; font-size: 18px; }
.terms-modal-close:hover { color: #374151; }

.terms-modal-body {
    padding: 0 20px;
    overflow: auto;
    max-height: 60vh;
    background: #fff; /* fundo branco melhora contraste e leitura */
}
.terms-content {
    padding: 20px 0;
    font-size: 15px;
    line-height: 1.7;
    color: #374151;
}
.terms-content h2 {
    font-size: 20px;
    margin: 4px 0 10px;
    color: #111827;
}
.terms-content h3 {
    font-size: 16px;
    margin: 18px 0 8px;
    color: #111827;
    padding-left: 10px;
    border-left: 3px solid #2563eb; /* acento visual sutil */
}
.terms-content p { margin: 0 0 10px; }
.terms-content ol, .terms-content ul { margin: 8px 0 12px; padding-left: 1.25rem; }
.terms-content li { margin: 6px 0; }
.terms-content a { color: #2563eb; text-decoration: underline; }
.terms-content a:hover { color: #1d4ed8; }
.terms-content small { color: #6b7280; }
.terms-content hr { border: 0; border-top: 1px solid #e5e7eb; margin: 16px 0; }
.terms-content strong { color: #111827; }
.terms-loading { color: #6b7280; padding: 20px 0; }

.terms-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}
.terms-footer-left small { color:#6b7280; }
.terms-footer-right { display:flex; gap:10px; }
.btn-terms-cancel { background: transparent; border: 1px solid #d1d5db; color:#374151; padding:10px 14px; border-radius:8px; font-weight:600; cursor:pointer; }
.btn-terms-cancel:hover { background:#f3f4f6; }
.btn-terms-confirm { background:#2563eb; color:#fff; border:0; padding:10px 14px; border-radius:8px; font-weight:700; cursor:pointer; display:inline-flex; align-items:center; gap:8px; }
.btn-terms-confirm[disabled] { opacity:.6; cursor:not-allowed; }

@media (max-width: 768px) {
  .terms-modal-content { width: 96vw; }
  .terms-modal-body { max-height: 58vh; }
}
