:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --accent-color: #ec4899;
    --bg-light: #f8fafc;
    --text-dark: #1e293b;
    --card-bg: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.3);
    --shadow-soft: 0 10px 40px -10px rgba(99, 102, 241, 0.15);
    --bottom-nav-height: 64px;
}

[data-theme="dark"] {
    --bg-light: #0f1117;
    --text-dark: #e5e7eb;
    --card-bg: #1a1d27;
    --glass-bg: rgba(26, 29, 39, 0.85);
    --glass-border: rgba(255, 255, 255, 0.08);
    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: #232734;
    border-color: rgba(255,255,255,0.12);
    color: var(--text-dark);
}
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: #232734;
    color: var(--text-dark);
}
[data-theme="dark"] .text-muted { color: #9ca3af !important; }
[data-theme="dark"] .swipe-pagination .page-link { background-color: #1a1d27; color: var(--text-dark); border-color: rgba(255,255,255,0.08); }

body {
    background-color: var(--bg-light);
    font-family: 'Inter', sans-serif;
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
}

[dir="rtl"] body { font-family: 'Vazirmatn', sans-serif; }
[dir="rtl"] .ms-auto { margin-right: auto !important; margin-left: 0 !important; }
[dir="rtl"] .me-2 { margin-left: 0.5rem !important; margin-right: 0 !important; }
[dir="rtl"] .ps-3 { padding-right: 1rem !important; padding-left: 0 !important; }

.navbar {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}
.navbar-brand {
    font-weight: 700;
    color: var(--primary-color) !important;
    letter-spacing: -0.5px;
}

.card-premium {
    background: var(--card-bg);
    border: none;
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}
.card-premium:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 50px -10px rgba(99, 102, 241, 0.25);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    padding: 10px 24px;
    border-radius: 12px;
    font-weight: 600;
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    transform: scale(1.02);
}

.ai-badge {
    background: linear-gradient(135deg, #e0e7ff, #fae8ff);
    color: #4338ca;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
}

.chat-bubble {
    max-width: 75%;
    padding: 12px 18px;
    border-radius: 18px;
    margin-bottom: 12px;
    position: relative;
    font-size: 0.95rem;
    line-height: 1.5;
}
.chat-sent {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}
.chat-received {
    background: var(--card-bg);
    color: var(--text-dark);
    margin-right: auto;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
[dir="rtl"] .chat-sent { border-bottom-left-radius: 4px; border-bottom-right-radius: 18px; }
[dir="rtl"] .chat-received { border-bottom-right-radius: 4px; border-bottom-left-radius: 18px; }

.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.glass-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* App-like bottom navigation (mobile) */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--glass-border);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
    z-index: 1030;
    padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav .nav-link {
    color: var(--text-dark);
    text-align: center;
    font-size: 0.7rem;
    padding: 8px 0;
}
.bottom-nav .nav-link.active,
.bottom-nav .nav-link:hover {
    color: var(--primary-color);
}
.bottom-nav i {
    display: block;
    font-size: 1.3rem;
    margin-bottom: 2px;
}

@media (max-width: 767.98px) {
    .bottom-nav { display: flex; }
    body { padding-bottom: var(--bottom-nav-height); }
    .desktop-only-nav { display: none !important; }
}

/* Plan / pricing cards */
.plan-card.featured {
    border: 2px solid var(--primary-color);
    transform: scale(1.02);
}

/* Counselor chat */
.counselor-bubble {
    max-width: 80%;
    padding: 12px 18px;
    border-radius: 18px;
    margin-bottom: 12px;
    font-size: 0.95rem;
    line-height: 1.55;
}
.counselor-user { background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); color:#fff; margin-left:auto; }
.counselor-assistant { background: var(--card-bg); box-shadow: 0 2px 10px rgba(0,0,0,0.05); margin-right:auto; }
[dir="rtl"] .counselor-user { margin-left:0; margin-right:auto; }
[dir="rtl"] .counselor-assistant { margin-right:0; margin-left:auto; }

/* Romantic public homepage */
.home-hero { margin-top: -1.5rem; }
.hero-slide {
    min-height: 60vh;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
}
.hero-fallback {
    background-image: linear-gradient(135deg, rgba(99,102,241,.85), rgba(236,72,153,.85)),
        url('https://images.unsplash.com/photo-1518199266791-5375a83190b7?auto=format&fit=crop&w=1600&q=80');
    background-size: cover;
    background-position: center;
}
.hero-slide-content { max-width: 720px; }
.hero-slide-content .btn-light:hover { transform: scale(1.03); }
.home-hero .carousel-indicators [data-bs-target] { background-color: rgba(255,255,255,.6); }
.home-hero .carousel-indicators .active { background-color: #fff; }
.hero-hearts {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 2;
}
.hero-hearts i {
    position: absolute;
    color: rgba(255,255,255,.35);
    animation: floatHeart 9s ease-in-out infinite;
}
.hero-hearts i:nth-child(1) { left: 6%; top: 70%; font-size: 1.4rem; animation-delay: 0s; }
.hero-hearts i:nth-child(2) { left: 18%; top: 20%; font-size: 1rem; animation-delay: 1.5s; }
.hero-hearts i:nth-child(3) { left: 50%; top: 80%; font-size: 1.8rem; animation-delay: 3s; }
.hero-hearts i:nth-child(4) { left: 78%; top: 25%; font-size: 1.2rem; animation-delay: 4.5s; }
.hero-hearts i:nth-child(5) { left: 90%; top: 65%; font-size: 1rem; animation-delay: 6s; }
@keyframes floatHeart {
    0%, 100% { transform: translateY(0) scale(1); opacity: .35; }
    50% { transform: translateY(-30px) scale(1.15); opacity: .6; }
}

.feature-icon-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    background: linear-gradient(135deg, #e0e7ff, #fae8ff);
    color: var(--primary-color);
}
.testimonial-card {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
}
.home-footer {
    background: linear-gradient(180deg, transparent, rgba(99,102,241,0.06));
    border-top: 1px solid var(--glass-border);
}
.admin-login-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-dark);
    opacity: 0.45;
    font-size: 0.8rem;
    text-decoration: none;
    transition: opacity 0.2s ease;
}
.admin-login-link:hover { opacity: 0.85; color: var(--primary-color); }

.admin-login-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}
.admin-login-banner i { font-size: 1.6rem; }

/* Personality quiz */
.quiz-option {
    cursor: pointer;
    border-color: var(--glass-border) !important;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.quiz-option:hover { background: var(--bg-light); }
.quiz-option:has(input:checked) {
    border-color: var(--primary-color) !important;
    background: linear-gradient(135deg, #eef2ff, #fdf2fa);
}
.personality-banner { border: 1px solid rgba(236,72,153,0.25); }

/* Swipe-gesture card stack (Discover) - progressive enhancement;
   .swipe-stack renders as a normal grid until discover.js adds
   .swipe-stack--enhanced and takes over layout via inline transforms. */
.swipe-stack-wrap { position: relative; }
.swipe-stack--enhanced {
    position: relative;
    max-width: 440px;
    margin: 0 auto;
    transition: height 0.3s ease;
}
.swipe-stack--enhanced .swipe-card-col {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 0;
    transition: transform 0.35s ease, opacity 0.35s ease;
    will-change: transform;
}
.swipe-stack--enhanced .swipe-card-col.swipe-dragging {
    transition: none;
}
.swipe-stack--enhanced .swipe-card {
    cursor: grab;
    user-select: none;
}
.swipe-stack--enhanced .swipe-card-photo-link { pointer-events: none; }
.swipe-pagination.swipe-stack-active { display: none !important; }

.swipe-card { position: relative; }
.swipe-like-stamp, .swipe-pass-stamp {
    position: absolute;
    top: 24px;
    z-index: 5;
    padding: 6px 16px;
    border-radius: 10px;
    border: 3px solid;
    font-size: 1.4rem;
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}
.swipe-like-stamp {
    left: 20px;
    color: #22c55e;
    border-color: #22c55e;
    transform: rotate(-18deg);
}
.swipe-pass-stamp {
    right: 20px;
    color: var(--accent-color);
    border-color: var(--accent-color);
    transform: rotate(18deg);
}
[dir="rtl"] .swipe-like-stamp { left: auto; right: 20px; transform: rotate(18deg); }
[dir="rtl"] .swipe-pass-stamp { right: auto; left: 20px; transform: rotate(-18deg); }

[data-theme="dark"] .glass-panel {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Online presence dot */
.online-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid var(--card-bg);
}
.online-dot-card {
    position: absolute;
    bottom: 10px;
    inset-inline-start: 10px;
    width: 14px;
    height: 14px;
    border: 2px solid white;
}

/* Theme toggle */
.theme-toggle-btn {
    border: none;
    background: transparent;
    color: var(--text-dark);
    font-size: 1.1rem;
    cursor: pointer;
}

/* Directional affordance icons (chevrons) point a physical direction by
   default - mirror them under RTL so "forward" still reads correctly. */
[dir="rtl"] .bi-chevron-right,
[dir="rtl"] .bi-chevron-left,
[dir="rtl"] .bi-arrow-right,
[dir="rtl"] .bi-arrow-left { display: inline-block; transform: scaleX(-1); }

/* Bootstrap's carousel controls are physical (left/right), not logical -
   for RTL the "next" direction is visually to the left, so swap sides and
   mirror the arrow glyphs themselves. */
[dir="rtl"] .carousel-control-prev { right: 0; left: auto; }
[dir="rtl"] .carousel-control-next { left: 0; right: auto; }
[dir="rtl"] .carousel-control-prev-icon,
[dir="rtl"] .carousel-control-next-icon { transform: scaleX(-1); }

/* Boost flame badge */
.boost-flame-badge {
    position: absolute;
    top: 10px;
    inset-inline-end: 10px;
    z-index: 5;
    background: linear-gradient(135deg, #f97316, var(--accent-color));
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 4px 14px -2px rgba(249, 115, 22, 0.5);
    animation: boostPulse 2s ease-in-out infinite;
}
@keyframes boostPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* Card reveal + prompt-chip tap feedback */
.swipe-card { animation: cardRevealFade 0.35s ease; }
@keyframes cardRevealFade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.icebreaker-suggestions button:active,
.glass-panel:active { transform: scale(0.97); }
.glass-panel { transition: transform 0.15s ease; }

/* Photo-count segment indicator (informational only - the swipe card stays
   single-photo to avoid conflicting with drag gestures; full carousel lives
   on the profile view). */
.photo-segments {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    z-index: 5;
}
.photo-segments span {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.45);
}
.photo-segments span:first-child { background: rgba(255, 255, 255, 0.9); }

.swipe-card-actions .swipe-pass-btn { width: 52px; flex: 0 0 auto; }

/* ---- Profile view + AI Profile Analyst ---- */
.min-width-0 { min-width: 0; }
.profile-photo-wrap { position: relative; }

.section-heading {
    border-inline-start: 4px solid var(--primary-color);
    padding-inline-start: 12px;
}

.interest-chip {
    background: linear-gradient(135deg, #eef2ff, #fdf2fa);
    color: #4338ca;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
}
[data-theme="dark"] .interest-chip {
    background: rgba(99, 102, 241, 0.18);
    color: #c7d2fe;
}

/* Compatibility ring (conic-gradient arc, --pct set inline 0-100) */
.compat-ring {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.1;
    background:
        radial-gradient(closest-side, var(--card-bg) 78%, transparent 79%),
        conic-gradient(var(--primary-color) calc(var(--pct, 70) * 1%), rgba(139, 92, 246, 0.18) 0);
}
.compat-ring-value { font-size: 1.35rem; font-weight: 800; color: var(--primary-color); }
.compat-ring-value small { font-size: 0.8rem; font-weight: 700; }
.compat-ring-label {
    font-size: 0.56rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 0 6px;
}

.ai-analyst-panel {
    padding: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 84px;
    max-height: calc(100vh - 104px);
    overflow: hidden;
}
@media (max-width: 991.98px) {
    .ai-analyst-panel { position: static; max-height: none; }
}
.ai-analyst-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--glass-border);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.10), rgba(236, 72, 153, 0.08));
}
.ai-analyst-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: #fff;
    font-size: 1.2rem;
}
.ai-analyst-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 220px;
    max-height: 440px;
}
.ai-bubble {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.ai-bubble-assistant {
    background: var(--bg-light);
    color: var(--text-dark);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.ai-bubble-user {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.ai-typing { display: flex; gap: 4px; align-items: center; min-width: 44px; }
.ai-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary-color);
    opacity: 0.4;
    animation: aiTyping 1s infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes aiTyping {
    0%, 100% { opacity: 0.3; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-3px); }
}
.ai-analyst-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 18px 0;
}
.ai-suggestion-chip {
    border: 1px solid rgba(99, 102, 241, 0.3);
    background: var(--card-bg);
    color: var(--primary-color);
    border-radius: 16px;
    padding: 5px 12px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}
.ai-suggestion-chip:hover { background: var(--bg-light); }
.ai-suggestion-chip:active { transform: scale(0.96); }
.ai-analyst-form {
    display: flex;
    gap: 8px;
    padding: 12px 18px 6px;
}
.ai-analyst-form .form-control { border-radius: 12px; }
.ai-analyst-disclaimer { padding: 0 18px 14px; }

/* Homepage capability cards */
.feature-showcase-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.feature-showcase-card::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    height: 4px;
    width: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    opacity: 0;
    transition: opacity 0.25s ease;
}
.feature-showcase-card:hover { transform: translateY(-6px); }
.feature-showcase-card:hover::before { opacity: 1; }

/* Initial-compatibility panel on a profile */
.compat-panel {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.07), rgba(236, 72, 153, 0.06));
    border: 1px solid var(--glass-border);
}
[data-theme="dark"] .compat-panel { background: rgba(99, 102, 241, 0.10); }
.compat-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.compat-dot-good { background: #22c55e; }
.compat-dot-ok { background: #f59e0b; }
.compat-dot-weak { background: #ef4444; }

/* "How to start chatting" hint on a profile */
.connect-hint {
    background: linear-gradient(135deg, #eef2ff, #fdf2fa);
    color: #4338ca;
    border-radius: 12px;
    padding: 10px 14px;
    line-height: 1.5;
}
[data-theme="dark"] .connect-hint {
    background: rgba(99, 102, 241, 0.15);
    color: #c7d2fe;
}

/* ---- Dashboard ---- */
.dashboard-hero {
    position: relative;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color) 55%, var(--accent-color));
}
.dashboard-hero-content { position: relative; z-index: 2; }
.dashboard-hero-glyph {
    position: absolute;
    inset-inline-end: -10px;
    bottom: -30px;
    font-size: 12rem;
    color: rgba(255, 255, 255, 0.12);
    z-index: 1;
    pointer-events: none;
}
.btn-glass {
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    border-radius: 12px;
    font-weight: 600;
    backdrop-filter: blur(4px);
}
.btn-glass:hover { background: rgba(255, 255, 255, 0.28); color: #fff; }

.stat-card { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.stat-card:hover { transform: translateY(-4px); }
a.stat-card:hover .feature-icon-circle { transform: scale(1.08); }
.stat-card .feature-icon-circle { width: 48px; height: 48px; font-size: 1.2rem; transition: transform 0.2s ease; }

/* Bigger, friendlier Discover empty state */
.discover-empty-cta .feature-icon-circle {
    width: 88px;
    height: 88px;
    font-size: 2.4rem;
    margin: 0 auto 1rem;
}
