/* =========================================================
   AI Dream Interpreter Pro — Public Styles
   فونت از قالب ارث‌بری می‌شود
   ========================================================= */

:root {
    --ai-primary:       #7c3aed;
    --ai-primary-dark:  #5b21b6;
    --ai-primary-light: #a78bfa;
    --ai-accent:        #f59e0b;
    --ai-accent-dark:   #d97706;
    --ai-success:       #10b981;
    --ai-danger:        #ef4444;
    --ai-warning:       #f59e0b;
    --ai-dark:          #0f172a;
    --ai-muted:         #64748b;
    --ai-light:         #f1f5f9;
    --ai-white:         #ffffff;
    --ai-gray:          #e2e8f0;
    --ai-radius:        20px;
}

/* ===== CONTAINER ===== */
.ai-dream-container {
    max-width: 860px;
    margin: 2rem auto;
    background: var(--ai-white);
    border-radius: var(--ai-radius);
    box-shadow: 0 8px 48px rgba(124,58,237,.10);
    overflow: hidden;
    direction: rtl;
}

/* ===== HERO HEADER ===== */
.ai-dream-header {
    background: linear-gradient(135deg, #1a0533 0%, #3b0764 45%, #7c3aed 100%);
    padding: 2.8rem 2.5rem 2.2rem;
    text-align: center;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.ai-dream-header::before {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 240px; height: 240px;
    background: radial-gradient(circle, rgba(245,158,11,.15) 0%, transparent 70%);
    border-radius: 50%;
}
.ai-dream-header::after {
    content: '';
    position: absolute;
    bottom: -40px; left: -40px;
    width: 180px; height: 180px;
    background: radial-gradient(circle, rgba(139,92,246,.25) 0%, transparent 70%);
    border-radius: 50%;
}
.ai-header-badge {
    display: inline-block;
    background: rgba(245,158,11,.15);
    border: 1px solid rgba(245,158,11,.35);
    color: #fcd34d;
    font-size: .72rem;
    font-weight: 700;
    padding: .3rem 1rem;
    border-radius: 20px;
    margin-bottom: 1rem;
    position: relative; z-index: 1;
}
.ai-dream-header h3 {
    margin: 0 0 .4rem;
    font-size: 1.9rem;
    font-weight: 900;
    position: relative; z-index: 1;
    text-shadow: 0 2px 12px rgba(0,0,0,.3);
    color: #fff;
}
.ai-dream-header > p {
    margin: 0;
    opacity: .85;
    font-size: .92rem;
    position: relative; z-index: 1;
    color: #fff;
}
.ai-header-trust {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.4rem;
    flex-wrap: wrap;
    position: relative; z-index: 1;
}
.ai-trust-item {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .75rem;
    color: rgba(255,255,255,.85);
    background: rgba(255,255,255,.09);
    padding: .3rem .75rem;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,.12);
}

/* ===== CONTENT ===== */
.ai-dream-content { padding: 2rem; }

/* ===== PILL TABS ===== */
.ai-type-switch {
    display: flex;
    gap: 0;
    margin-bottom: 1.4rem;
    background: var(--ai-light);
    padding: 5px;
    border-radius: 14px;
    border: 1px solid var(--ai-gray);
}
.ai-pill {
    flex: 1;
    text-align: center;
    padding: .8rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all .25s cubic-bezier(.4,0,.2,1);
    font-weight: 600;
    font-size: .88rem;
    color: var(--ai-muted);
    user-select: none;
}
.ai-pill.active {
    background: var(--ai-white);
    color: var(--ai-primary);
    box-shadow: 0 2px 10px rgba(124,58,237,.14);
}
.ai-pill[data-type="paid"].active {
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-primary-light));
    color: #fff;
    box-shadow: 0 4px 16px rgba(124,58,237,.3);
}

/* ===== INPUT ===== */
.ai-input-wrap { position: relative; margin-bottom: 1rem; }
.ai-dream-input {
    width: 100%;
    padding: 1rem 1.2rem 2rem;
    border: 2px solid var(--ai-gray);
    border-radius: 14px;
    font-size: .93rem;
    resize: vertical;
    min-height: 130px;
    transition: all .25s;
    box-sizing: border-box;
    color: var(--ai-dark);
    background: #fafafe;
    line-height: 1.7;
}
.ai-dream-input::placeholder { color: #94a3b8; }
.ai-dream-input:focus {
    outline: none;
    border-color: var(--ai-primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(124,58,237,.07);
}
.ai-char-count {
    position: absolute;
    bottom: 10px; left: 14px;
    font-size: .7rem;
    color: #94a3b8;
}

/* ===== SUBMIT BUTTON ===== */
.ai-dream-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-primary-dark));
    color: #fff;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 14px;
    font-size: .97rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .28s cubic-bezier(.4,0,.2,1);
    position: relative;
    overflow: hidden;
}
.ai-dream-btn::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,.12), transparent);
    opacity: 0;
    transition: opacity .25s;
}
.ai-dream-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(124,58,237,.38); }
.ai-dream-btn:hover::after { opacity: 1; }
.ai-dream-btn:active { transform: translateY(0); }
.ai-dream-btn:disabled { opacity: .6; transform: none; cursor: not-allowed; }

/* ===== CREDIT CARD DASHBOARD ===== */
.ai-credit-card {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 55%, #2d1b69 100%);
    border-radius: 16px;
    margin: 1.2rem 0;
    color: #fff;
    display: flex;
    align-items: stretch;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(15,23,42,.22);
    flex-wrap: wrap;
}
.ai-credit-block {
    flex: 1;
    min-width: 120px;
    padding: 1.1rem 1.3rem;
    display: flex;
    align-items: center;
    gap: .75rem;
}
.ai-credit-free   { background: rgba(16,185,129,.12); }
.ai-credit-paid   { background: rgba(124,92,231,.18); }
.ai-credit-login  { background: rgba(245,158,11,.09); flex: 2; justify-content: center; }
.ai-credit-divider { width: 1px; background: rgba(255,255,255,.08); align-self: stretch; }
.ai-credit-icon   { font-size: 1.6rem; line-height: 1; flex-shrink: 0; }
.ai-credit-info   { display: flex; flex-direction: column; gap: .1rem; }
.ai-credit-label  { font-size: .69rem; opacity: .7; white-space: nowrap; }
.ai-credit-value  { font-size: 1.35rem; font-weight: 800; line-height: 1; color: #fff; }
.ai-credit-sep    { opacity: .4; font-size: .9rem; }
.ai-credit-sub    { font-size: .66rem; opacity: .55; white-space: nowrap; }

/* Login link in credit card */
.ai-credit-login-btn {
    color: #fcd34d;
    text-decoration: none;
    font-weight: 700;
    font-size: .85rem;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.1rem;
    border-radius: 10px;
    background: rgba(245,158,11,.12);
    border: 1px solid rgba(245,158,11,.28);
    cursor: pointer;
    transition: all .2s;
}
.ai-credit-login-btn:hover {
    background: rgba(245,158,11,.22);
    color: #fcd34d;
    transform: translateY(-1px);
    text-decoration: none;
}

/* ===== LOADER ===== */
.ai-loader-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.78);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    backdrop-filter: blur(4px);
}
.ai-loader-spinner {
    background: #fff;
    padding: 2.5rem 3rem;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.28);
    max-width: 320px;
}
.ai-spinner {
    width: 50px; height: 50px;
    border: 4px solid var(--ai-gray);
    border-top-color: var(--ai-primary);
    border-radius: 50%;
    animation: aiSpin .9s linear infinite;
    margin: 0 auto 1.1rem;
}
.ai-loader-spinner p  { font-weight: 700; color: var(--ai-dark); margin: 0 0 .3rem; }
.ai-loader-spinner small { color: var(--ai-muted); font-size: .8rem; }

/* ===== RESULT ===== */
.ai-dream-result {
    margin-top: 1.4rem;
    display: none;
    animation: aiFadeUp .45s ease;
}
.ai-dream-section {
    background: #fafafe;
    border-radius: 14px;
    padding: 1.3rem 1.4rem;
    margin-bottom: .8rem;
    border-right: 4px solid var(--ai-primary);
    transition: transform .2s;
}
.ai-dream-section:hover { transform: translateX(-2px); }
.ai-dream-section h4 {
    margin: 0 0 .7rem;
    color: var(--ai-primary);
    font-size: .97rem;
    font-weight: 700;
}
.ai-dream-section p { line-height: 1.9; color: var(--ai-dark); font-size: .91rem; margin: 0; }

/* ===== UPSELL ===== */
.ai-dream-upsell {
    background: linear-gradient(135deg, #1a0533 0%, #4c1d95 100%);
    color: #fff;
    padding: 1.7rem;
    border-radius: 18px;
    margin-top: 1.1rem;
    text-align: center;
    box-shadow: 0 8px 32px rgba(124,58,237,.28);
    animation: aiFadeUp .45s ease;
    border: 1px solid rgba(139,92,246,.28);
    position: relative; overflow: hidden;
}
.ai-dream-upsell::before {
    content: '✨';
    position: absolute; top: -10px; right: -10px;
    font-size: 5rem; opacity: .06;
}
.ai-dream-upsell h4 { margin: 0 0 .7rem; font-size: 1.2em; font-weight: 800; color: #fff; }
.ai-dream-upsell p  { margin: .7rem 0; line-height: 1.85; opacity: .92; font-size: .88rem; }
.ai-upsell-btn {
    display: inline-block;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #1a0533;
    border: none;
    padding: .85rem 2rem;
    border-radius: 30px;
    font-weight: 800;
    cursor: pointer;
    font-size: .95rem;
    margin-top: .8rem;
    transition: all .28s;
    box-shadow: 0 4px 16px rgba(245,158,11,.38);
    text-decoration: none;
}
.ai-upsell-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(245,158,11,.48);
    color: #1a0533;
    text-decoration: none;
}

/* ===== MODAL SYSTEM ===== */
.ai-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.72);
    z-index: 999999;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    backdrop-filter: blur(5px);
}
.ai-modal-overlay.active { display: flex; animation: aiFadeIn .22s ease; }

.ai-modal {
    background: #fff;
    border-radius: 24px;
    width: 100%;
    max-width: 500px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0,0,0,.32);
    animation: aiModalIn .32s cubic-bezier(.34,1.56,.64,1);
    position: relative;
    direction: rtl;
}

/* scrollbar inside modal */
.ai-modal::-webkit-scrollbar { width: 5px; }
.ai-modal::-webkit-scrollbar-track { background: transparent; }
.ai-modal::-webkit-scrollbar-thumb { background: var(--ai-gray); border-radius: 10px; }

.ai-modal-close {
    position: absolute;
    top: 1rem; left: 1rem;
    background: var(--ai-light);
    border: none;
    width: 34px; height: 34px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ai-muted);
    transition: all .18s;
    z-index: 2;
    line-height: 1;
}
.ai-modal-close:hover { background: var(--ai-gray); color: var(--ai-dark); }

/* --- Modal tabs (ورود / ثبت‌نام) --- */
.ai-modal-tabs {
    display: flex;
    border-bottom: 2px solid var(--ai-light);
}
.ai-modal-tab {
    flex: 1;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    font-weight: 700;
    font-size: .9rem;
    color: var(--ai-muted);
    transition: all .2s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}
.ai-modal-tab.active {
    color: var(--ai-primary);
    border-bottom-color: var(--ai-primary);
}
.ai-modal-tab:hover:not(.active) { color: var(--ai-dark); }

.ai-modal-panel { display: none; }
.ai-modal-panel.active { display: block; }

.ai-modal-header {
    padding: 1.8rem 1.8rem 1rem;
}
.ai-modal-icon {
    width: 56px; height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    margin-bottom: .9rem;
}
.ai-modal-icon.purple { background: linear-gradient(135deg, #ede9fe, #ddd6fe); }
.ai-modal-icon.gold   { background: linear-gradient(135deg, #fef3c7, #fde68a); }

.ai-modal-header h2 { margin: 0 0 .25rem; font-size: 1.2rem; font-weight: 800; color: var(--ai-dark); }
.ai-modal-header p  { margin: 0; color: var(--ai-muted); font-size: .83rem; line-height: 1.55; }

.ai-modal-body { padding: 1rem 1.8rem 1.8rem; }

/* --- Form fields --- */
.ai-field       { margin-bottom: .9rem; }
.ai-field-row   { display: flex; gap: .75rem; }
.ai-field-row .ai-field { flex: 1; margin-bottom: 0; }

.ai-field label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--ai-dark);
    margin-bottom: .35rem;
}
.ai-field label .req { color: var(--ai-danger); margin-right: .15rem; }

.ai-field input {
    width: 100%;
    padding: .75rem 1rem;
    border: 2px solid var(--ai-gray);
    border-radius: 11px;
    font-size: .9rem;
    transition: all .2s;
    box-sizing: border-box;
    color: var(--ai-dark);
    background: #fafafe;
}
.ai-field input:focus {
    outline: none;
    border-color: var(--ai-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(124,58,237,.07);
}
.ai-field input.error { border-color: var(--ai-danger); }

.ai-modal-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-primary-dark));
    color: #fff;
    border: none;
    padding: .88rem 1.5rem;
    border-radius: 12px;
    font-size: .93rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .28s;
    margin-top: .4rem;
}
.ai-modal-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(124,58,237,.32); }
.ai-modal-btn:disabled { opacity: .6; transform: none; cursor: not-allowed; }
.ai-modal-btn.secondary {
    background: var(--ai-light);
    color: var(--ai-primary);
    box-shadow: none;
}
.ai-modal-btn.secondary:hover { background: #e8e0ff; }

.ai-form-footer {
    text-align: center;
    font-size: .8rem;
    color: var(--ai-muted);
    margin-top: .9rem;
}

/* ===== PACKAGES MODAL ===== */
.ai-packages-grid { display: flex; flex-direction: column; gap: .8rem; }

.ai-package-card {
    border: 2px solid var(--ai-gray);
    border-radius: 16px;
    padding: 1.1rem 1.3rem;
    cursor: pointer;
    transition: all .22s cubic-bezier(.4,0,.2,1);
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}
.ai-package-card:hover {
    border-color: var(--ai-primary);
    box-shadow: 0 4px 20px rgba(124,58,237,.12);
    transform: translateY(-1px);
}
.ai-package-card.featured {
    border-color: var(--ai-primary);
    background: linear-gradient(135deg, #faf5ff, #f3e8ff);
}
.ai-package-card.featured::before {
    content: '⭐ پرفروش';
    position: absolute; top: 0; left: 0;
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-primary-light));
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    padding: .22rem .75rem;
    border-radius: 0 0 10px 0;
}

.ai-pkg-icon {
    width: 48px; height: 48px;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    color: #fff;
}
.ai-pkg-info  { flex: 1; min-width: 0; }
.ai-pkg-name  { font-weight: 700; color: var(--ai-dark); font-size: .93rem; margin-bottom: .18rem; }
.ai-pkg-credits { font-size: .75rem; color: var(--ai-muted); }
.ai-pkg-price { text-align: left; flex-shrink: 0; }
.ai-pkg-amount { font-size: 1.1rem; font-weight: 800; color: var(--ai-primary); display: block; white-space: nowrap; }
.ai-pkg-unit  { font-size: .68rem; color: var(--ai-muted); }

.ai-pkg-buy-btn {
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-primary-dark));
    color: #fff;
    border: none;
    padding: .5rem 1rem;
    border-radius: 9px;
    font-weight: 700;
    font-size: .8rem;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.ai-pkg-buy-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(124,58,237,.32); }
.ai-pkg-buy-btn:disabled { opacity: .6; transform: none; }

.ai-packages-empty {
    text-align: center;
    padding: 2rem;
    color: var(--ai-muted);
    font-size: .88rem;
}

/* ===== FEEDBACK ===== */
.ai-feedback-section {
    margin-top: 1.4rem;
    padding: 1.4rem;
    background: var(--ai-light);
    border-radius: 14px;
    display: none;
}
.ai-feedback-section h4 { margin: 0 0 .9rem; font-size: .92rem; font-weight: 700; color: var(--ai-dark); }
.feedback-buttons { display: flex; gap: .7rem; margin: .7rem 0; }
.feedback-btn {
    flex: 1;
    padding: .65rem;
    border: 2px solid var(--ai-gray);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: all .2s;
    font-size: .85rem;
    font-weight: 600;
    color: var(--ai-dark);
}
.feedback-btn:hover { border-color: var(--ai-primary); }
.feedback-btn.active-yes { background: var(--ai-success); border-color: var(--ai-success); color: #fff; }
.feedback-btn.active-no  { background: var(--ai-danger);  border-color: var(--ai-danger);  color: #fff; }

#feedback-text {
    width: 100%;
    padding: .75rem 1rem;
    border: 2px solid var(--ai-gray);
    border-radius: 10px;
    font-size: .85rem;
    resize: vertical;
    min-height: 76px;
    box-sizing: border-box;
    margin: .7rem 0;
    transition: border-color .2s;
    color: var(--ai-dark);
    background: #fff;
}
#feedback-text:focus { outline: none; border-color: var(--ai-primary); }

/* ===== TOAST ===== */
.ai-toast {
    position: fixed;
    bottom: 22px; right: 22px;
    padding: .85rem 1.3rem;
    border-radius: 12px;
    background: var(--ai-dark);
    color: #fff;
    z-index: 1000000;
    animation: aiSlideRight .28s ease;
    font-size: .86rem;
    font-weight: 600;
    box-shadow: 0 8px 28px rgba(0,0,0,.18);
    max-width: 320px;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.ai-toast.success { background: var(--ai-success); }
.ai-toast.error   { background: var(--ai-danger);  }
.ai-toast.warning { background: var(--ai-accent-dark); }

/* ===== HIDDEN LEGACY ===== */
.ai-quick-register,
.ai-packages-wrap { display: none !important; }

/* ===== KEYFRAMES ===== */
@keyframes aiSpin      { to { transform: rotate(360deg); } }
@keyframes aiFadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes aiFadeUp    { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes aiModalIn   { from { opacity: 0; transform: scale(.88) translateY(18px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes aiSlideRight { from { transform: translateX(100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .ai-dream-container  { margin: .75rem; border-radius: 16px; }
    .ai-dream-content    { padding: 1.2rem; }
    .ai-dream-header     { padding: 2rem 1.5rem 1.7rem; }
    .ai-dream-header h3  { font-size: 1.45rem; }

    /* Bottom sheet on mobile */
    .ai-modal-overlay { align-items: flex-end; padding: 0; }
    .ai-modal {
        border-radius: 22px 22px 0 0;
        max-height: 92vh;
        max-width: 100%;
    }

    .ai-field-row { flex-direction: column; gap: .9rem; }

    .ai-credit-card { flex-direction: column; }
    .ai-credit-divider { width: 100%; height: 1px; }

    .ai-toast { right: 10px; bottom: 10px; left: 10px; max-width: none; }
}

@media (max-width: 420px) {
    .ai-pill { font-size: .8rem; padding: .65rem .4rem; }
    .ai-header-trust { gap: .45rem; }
}
