/* ==========================================
   Smart Modal System - Tradielist Theme
   ========================================== */

.smart-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 14, 23, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.22s ease;
}

.smart-modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.smart-modal-card {
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 35px rgba(255, 107, 0, 0.08);
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    max-height: min(90dvh, 90vh);
    padding: 28px;
    margin: auto;
    color: #f9fafb;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transform: scale(0.92) translateY(12px);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    box-sizing: border-box;
}

.smart-modal-backdrop.active .smart-modal-card {
    transform: scale(1) translateY(0);
}

/* Glow bar on top */
.smart-modal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ff6b00, #ff8c38);
    border-radius: 20px 20px 0 0;
}

.smart-modal-card.type-danger::before {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.smart-modal-card.type-warning::before {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.smart-modal-card.type-success::before {
    background: linear-gradient(90deg, #10b981, #34d399);
}

.smart-modal-card.type-info::before {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

/* Header & Icon */
.smart-modal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 14px;
}

.smart-modal-icon-badge {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-bottom: 16px;
    background: rgba(255, 107, 0, 0.12);
    color: #ff6b00;
    border: 1px solid rgba(255, 107, 0, 0.25);
    box-shadow: 0 0 20px rgba(255, 107, 0, 0.15);
}

.smart-modal-card.type-danger .smart-modal-icon-badge {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.25);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
}

.smart-modal-card.type-warning .smart-modal-icon-badge {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.25);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.15);
}

.smart-modal-card.type-success .smart-modal-icon-badge {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.25);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}

.smart-modal-card.type-info .smart-modal-icon-badge {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
    border-color: rgba(59, 130, 246, 0.25);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
}

.smart-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 8px 0;
    letter-spacing: -0.01em;
}

.smart-modal-body {
    font-size: 0.95rem;
    color: #9ca3af;
    line-height: 1.55;
    text-align: center;
    margin-bottom: 20px;
    word-break: break-word;
}

/* Prompt input field */
.smart-modal-input-wrap {
    margin-top: 12px;
    margin-bottom: 8px;
    width: 100%;
}

.smart-modal-input {
    width: 100%;
    background: #1f2937;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 12px 14px;
    color: #f9fafb;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.smart-modal-input:focus {
    border-color: #ff6b00;
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.2);
}

/* Actions Footer */
.smart-modal-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
}

.smart-modal-btn {
    flex: 1;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
    outline: none;
}

.smart-modal-btn-cancel {
    background: rgba(255, 255, 255, 0.07);
    color: #d1d5db;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.smart-modal-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.13);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
}

.smart-modal-btn-confirm {
    background: linear-gradient(135deg, #ff6b00, #ea580c);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(255, 107, 0, 0.35);
}

.smart-modal-btn-confirm:hover {
    background: linear-gradient(135deg, #ff7b1a, #f97316);
    box-shadow: 0 6px 18px rgba(255, 107, 0, 0.45);
    transform: translateY(-1px);
}

.smart-modal-card.type-danger .smart-modal-btn-confirm {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.smart-modal-card.type-danger .smart-modal-btn-confirm:hover {
    background: linear-gradient(135deg, #f87171, #ef4444);
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.45);
}

.smart-modal-card.type-warning .smart-modal-btn-confirm {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

.smart-modal-card.type-warning .smart-modal-btn-confirm:hover {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    box-shadow: 0 6px 18px rgba(245, 158, 11, 0.45);
}

.smart-modal-card.type-success .smart-modal-btn-confirm {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.smart-modal-card.type-success .smart-modal-btn-confirm:hover {
    background: linear-gradient(135deg, #34d399, #10b981);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
}

/* Close button top right */
.smart-modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: #6b7280;
    font-size: 1.1rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.smart-modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f3f4f6;
}

@media (max-width: 768px) {
    .smart-modal-card {
        width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        max-height: calc(100vh - 32px);
        overflow-y: auto;
    }
    .smart-modal-btn,
    .smart-modal-close-btn {
        min-height: 44px;
        min-width: 44px;
    }
}
