/* ============================================
   SISTEMA DE MODAL - Design Clean & Profissional
   ============================================ */

#modal-root {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
}

/* Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: all;
    transition: opacity 0.2s ease;
}

.modal-overlay.modal-show {
    opacity: 1;
}

/* Container do Modal */
.modal-container {
    background: #1a1f2e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
    max-width: 420px;
    width: 100%;
    transform: scale(0.96) translateY(8px);
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.modal-overlay.modal-show .modal-container {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Header */
.modal-header {
    padding: 1.5rem 1.5rem 0.5rem 1.5rem;
    text-align: center;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    letter-spacing: -0.01em;
    line-height: 1.4;
}

/* Body */
.modal-body {
    padding: 1rem 1.5rem 1.5rem 1.5rem;
}

.modal-message {
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    font-size: 0.9375rem;
    margin: 0;
    white-space: pre-wrap;
    text-align: center;
}

/* Footer */
.modal-footer {
    display: flex;
    gap: 0.75rem;
    padding: 0 1.5rem 1.5rem 1.5rem;
    justify-content: center;
}

/* Botões */
.modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    min-width: 100px;
}

.modal-btn:focus {
    outline: none;
}

.modal-btn:active {
    transform: scale(0.98);
}

/* Botão OK / Primary */
.modal-btn-ok {
    background: #3b82f6;
    color: white;
}

.modal-btn-ok:hover {
    background: #2563eb;
}

.modal-btn-ok:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

/* Botão Cancel / Secondary */
.modal-btn-cancel {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.modal-btn-cancel:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}


/* Checkbox */
.modal-checkbox {
    padding: 0 1.5rem 1.5rem 1.5rem;
    text-align: center;
}

.modal-checkbox label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8125rem;
}

.modal-checkbox input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    accent-color: #3b82f6;
    border-radius: 4px;
}

/* Variantes de cor do botão baseado no tipo */
.modal-container[data-type="success"] .modal-btn-ok {
    background: #22c55e;
}

.modal-container[data-type="success"] .modal-btn-ok:hover {
    background: #16a34a;
}

.modal-container[data-type="success"] .modal-btn-ok:focus {
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}

.modal-container[data-type="error"] .modal-btn-ok {
    background: #ef4444;
}

.modal-container[data-type="error"] .modal-btn-ok:hover {
    background: #dc2626;
}

.modal-container[data-type="error"] .modal-btn-ok:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25);
}

.modal-container[data-type="warning"] .modal-btn-ok {
    background: #3b82f6;
}

/* Responsivo - Mobile */
@media (max-width: 480px) {
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal-container {
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
    }

    .modal-overlay.modal-show .modal-container {
        transform: translateY(0);
    }

    .modal-header {
        padding: 1.25rem 1.25rem 0 1.25rem;
    }

    .modal-body {
        padding: 0.875rem 1.25rem 1.25rem 1.25rem;
    }

    .modal-footer {
        flex-direction: column-reverse;
        padding: 0 1.25rem 1.25rem 1.25rem;
        gap: 0.5rem;
    }

    .modal-btn {
        width: 100%;
        padding: 0.875rem 1rem;
    }

    .modal-checkbox {
        padding: 0 1.25rem 1.25rem 1.25rem;
    }
}

/* ============================================
   MODAL ITEM PREVIEW - Confirmação de Compra
   (Mesmo estilo do marketplace)
   ============================================ */

.modal-item-preview {
    display: flex;
    align-items: stretch;
    gap: 0.875rem;
    padding: 0.875rem;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    text-align: left;
}

.modal-item-image {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 30, 48, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 8px;
}

.modal-item-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.modal-item-name {
    font-weight: 600;
    color: #ffffff;
    font-size: 0.95rem;
    line-height: 1.3;
    margin-bottom: 4px;
}

.modal-item-name .refine {
    color: #ff9800;
    font-weight: 600;
}

.modal-item-name .item-stock {
    font-size: 0.7rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

.modal-item-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.modal-card-sprite {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #ff9800;
    white-space: nowrap;
}

.modal-card-sprite img {
    background: transparent;
    border: none;
}

.modal-item-options {
    display: inline-block;
    font-size: 0.75rem;
    color: #ab47bc;
    background: rgba(171, 71, 188, 0.1);
    border: 1px solid rgba(171, 71, 188, 0.15);
    border-radius: 4px;
    padding: 4px 8px;
    line-height: 1.3;
}

/* Seção do Vendedor no Modal */
.modal-seller-section {
    padding: 0.75rem 1rem;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.modal-seller-label {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.modal-seller-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.modal-seller-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-seller-name {
    color: #ffffff;
    font-weight: 600;
    font-size: 0.9375rem;
}

.modal-seller-vip {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #000;
    font-size: 0.5625rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.modal-seller-details {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.modal-seller-class {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8125rem;
}

.modal-seller-guild {
    color: #a78bfa;
    font-size: 0.8125rem;
}

.modal-seller-guild::before {
    content: "·";
    margin-right: 0.5rem;
    color: rgba(255, 255, 255, 0.3);
}

.modal-seller-stats {
    display: flex;
    gap: 1rem;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.modal-seller-stats strong {
    color: #4fc3f7;
    font-weight: 600;
}

.modal-item-notice {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
}

/* ============================================
   QUANTITY SELECTOR - Selecao de quantidade
   ============================================ */

.modal-quantity-section {
    padding: 0.875rem;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.modal-quantity-label {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.modal-quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-qty-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #ffffff;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.modal-qty-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.modal-qty-btn:active {
    transform: scale(0.95);
}

.modal-qty-input {
    width: 60px;
    height: 32px;
    background: #1e293b !important;
    border: 1px solid rgba(79, 195, 247, 0.3);
    border-radius: 6px;
    color: #4fc3f7 !important;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    -moz-appearance: textfield;
}

.modal-qty-input::-webkit-outer-spin-button,
.modal-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    appearance: none !important;
    margin: 0 !important;
    display: none !important;
}

.modal-qty-input:focus {
    outline: none;
    border-color: rgba(79, 195, 247, 0.5);
}

.modal-qty-max {
    padding: 0.375rem 0.75rem;
    background: rgba(79, 195, 247, 0.1);
    border: 1px solid rgba(79, 195, 247, 0.25);
    border-radius: 6px;
    color: #4fc3f7;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.15s ease;
}

.modal-qty-max:hover {
    background: rgba(79, 195, 247, 0.18);
    border-color: rgba(79, 195, 247, 0.4);
}

.modal-quantity-stock {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
}

/* ============================================
   PRICE SECTION - Preco unitario e total
   ============================================ */

.modal-price-section {
    padding: 0.75rem;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.modal-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
}

.modal-price-row + .modal-price-row {
    margin-top: 0.25rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-price-label {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.6);
}

.modal-price-value {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 0.9375rem;
    color: #4fc3f7;
}

.modal-price-value .cash-icon {
    vertical-align: middle;
}

.modal-price-total .modal-price-label {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

.modal-price-total .modal-price-value {
    font-size: 1.125rem;
    color: #facc15;
}

/* Modal Success Content */
.modal-success-content {
    text-align: center;
}

.modal-success-item {
    font-weight: 600;
    color: #ffffff;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.modal-success-price {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.25rem;
}

.modal-success-balance {
    font-size: 0.875rem;
    color: #22c55e;
    font-weight: 500;
    margin-bottom: 1rem;
}

.modal-success-notice {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.5);
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ============================================
   SELLER INFO MODAL
   ============================================ */

.seller-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.seller-modal-overlay.show {
    opacity: 1;
}

.seller-modal {
    position: relative;
    background: #1a1f2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
    padding: 1.25rem;
    min-width: 260px;
    max-width: 320px;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.seller-modal-overlay.show .seller-modal {
    transform: scale(1);
}

.seller-modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.15s ease;
}

.seller-modal-close:hover {
    color: #ffffff;
}

.seller-modal-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.seller-modal-name {
    font-weight: 600;
    color: #ffffff;
    font-size: 0.9375rem;
}

.seller-modal-vip {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #000;
    font-size: 0.625rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.seller-modal-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    font-size: 0.8125rem;
}

.seller-modal-label {
    color: rgba(255, 255, 255, 0.5);
}

.seller-modal-value {
    color: #ffffff;
    font-weight: 500;
}

.seller-modal-value.guild {
    color: #a78bfa;
}

.seller-modal-stats {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.seller-modal-stat {
    text-align: center;
    flex: 1;
}

.seller-modal-stat.clickable {
    text-decoration: none;
    padding: 0.5rem;
    margin: -0.5rem;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.seller-modal-stat.clickable:hover {
    background: rgba(255, 255, 255, 0.05);
}

.seller-modal-stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: #22c55e;
}

.seller-modal-stat-label {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
}

.seller-modal-stat-value.sold {
    color: #22c55e;
}

.seller-modal-stat-value.listed {
    color: #22c55e;
}

.seller-modal-stat-value.reserved {
    color: #f59e0b;
}

/* Animação de entrada suave */
@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
