/* --- New Cosmic Gradient Theme Variables --- */
:root {
    --bg-color-start: #1a0b2e; /* Deep Purple */
    --bg-color-mid: #0d1117;   /* Original Dark Blue/Black */
    --bg-color-end: #2e0b25;   /* Deep Magenta */

    --text-color: #e6e6e6;
    --secondary-text-color: #c5c5c5; /* Even Lighter gray for better readability */
    --navbar-bg: #141928; /* Solid Dark Slate Blue */

    /* Glassmorphism Card */
    --card-bg: rgba(10, 10, 15, 0.85);
    --card-border-color: rgba(255, 255, 255, 0.1);
    --card-blur: 8px;

    /* Neon Accents */
    --accent-color-primary: #00f2ff; /* Neon Blue/Cyan */
    --accent-color-secondary: #ff00e6; /* Neon Pink/Magenta */
    --accent-color-tertiary: #f2ff00; /* Neon Yellow */

    --link-color: var(--accent-color-primary);
    --link-hover-color: #ffffff;

    --btn-primary-bg: linear-gradient(45deg, var(--accent-color-primary), var(--accent-color-secondary));
    --btn-primary-text: #000000;
    --btn-secondary-bg: rgba(255, 255, 255, 0.1);
    --btn-secondary-text: #ffffff;
    --btn-secondary-border: rgba(255, 255, 255, 0.2);
}

html {
    overflow-x: hidden; /* Prevent horizontal scroll on the root */
}

/* Tab Pane Fix for Layout Gaps */
.tab-pane {
    height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease-in-out;
}

.tab-pane.fade.show.active {
    height: auto;
    overflow: visible;
}

/* --- Force AOS elements to be visible --- */
[data-aos] {
    opacity: 1 !important;
    transform: none !important;
}

/* --- Light Mode Theme Variables (Softer & Unified) --- */
html[data-bs-theme='light'] {
    --bg-color-start: #e9edf1;   /* Softer Grayish Blue */
    --bg-color-mid: #f0f2f5;     /* Light Gray */
    --bg-color-end: #f1eef1;     /* Softer Grayish Purple */

    --text-color: #2c3e50; /* Darker, softer blue-gray for text */
    --secondary-text-color: #808c99; /* Muted gray */
    --navbar-bg: #F0F2F5; /* Solid Soft Off-White */

    /* Glassmorphism Card in Light Mode */
    --card-bg: rgba(248, 249, 250, 0.85); /* Light gray, more opaque */
    --card-border-color: rgba(0, 0, 0, 0.08); /* Softer border */
    --card-blur: 10px;

    --link-color: #0056b3; /* Dark, standard blue for links */
    --link-hover-color: #003d80;

    --btn-primary-text: #ffffff; /* White text on gradient button */
    --btn-secondary-bg: rgba(0, 0, 0, 0.04);
    --btn-secondary-text: #2c3e50;
    --btn-secondary-border: rgba(0, 0, 0, 0.1);

    --table-header-bg: #e9ecef; /* Darker header */
    --table-header-text: #2c3e50;
    --table-row-bg: #f8f9fa; /* Light gray rows */
    --table-row-hover-bg: #e9ecef; /* Darker hover */
}


/* --- Base & Typography --- */
main {
    flex: 1 0 auto; /* Ensures main content takes up available space, pushing footer down */
    flex-grow: 1; /* Allows main content to fill the space, pushing footer down */
    overflow-x: hidden; /* Prevents horizontal scroll within the main content area */
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    color: var(--text-color);
    line-height: 1.7;
    padding-top: 95px; /* Account for fixed-top navbar - fully clear navbar with safe margin */

    /* Flexbox for Sticky Footer */
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Ensure body is at least full viewport height */
    margin: 0; /* Remove default browser margin */

    /* Background and Word Wrapping */
    word-wrap: break-word; 
    overflow-wrap: break-word;
    background: linear-gradient(-45deg, var(--bg-color-start), var(--bg-color-mid), var(--bg-color-end));
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

/* Reduce padding-top for mobile devices */
@media (max-width: 767px) {
    body {
        padding-top: 58px; /* Minimal padding for mobile - just enough to clear navbar */
    }
    
    .navbar-container .navbar {
        padding: 0.4rem 0; /* Reduce navbar padding on mobile */
    }
}

/* @keyframes gradientBG animation removed */

html[lang="fa"] body {
    font-family: 'Vazirmatn', sans-serif;
    text-align: right; /* Ensure RTL text alignment */
}

.text-muted {
    color: var(--secondary-text-color) !important;
}

a {
    color: var(--link-color);
}

a:hover {
    color: var(--link-hover-color);
}

#password-strength-rules {
    color: #adb5bd; /* Muted text color for less emphasis */
}

/* --- Base Styles --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

main {
    flex: 1 0 auto; /* Ensures main content takes up available space, pushing footer down */
    overflow-x: hidden; /* Prevents horizontal scroll within the main content area */
}

.site-footer {
    background-color: var(--navbar-bg);
    color: var(--secondary-text-color);
    flex-shrink: 0;
}

.site-footer .footer-heading {
    color: var(--text-color);
}

.site-footer a, .site-footer .footer-text {
    color: rgba(255, 255, 255, 0.7);
}

.site-footer a:hover {
    color: var(--accent-color);
}


/* --- Quick Access Menu --- */
.quick-access-menu {
    background-color: var(--navbar-bg);
    transition: background-color 0.3s ease-in-out;
}

/* --- Theme Switch Icon Consistency --- */
.theme-switch i {
    width: 1.1em; /* Ensures both sun and moon icons occupy the same space */
    text-align: center;
}

/* --- Header Buttons Uniform Width and Alignment --- */
.navbar .d-flex.align-items-center > .btn.btn-sm,
.navbar .d-flex.align-items-center > .dropdown > .btn.btn-sm {
    min-width: 45px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.75rem;
    vertical-align: middle;
    box-sizing: border-box;
}

/* Ensure all header dropdowns have consistent width */
.navbar .d-flex.align-items-center > .dropdown {
    display: inline-flex;
    align-items: center;
}

/* Make sure icons inside buttons are centered */
.navbar .btn.btn-sm i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* --- Components --- */

/* Ensures the navbar stays on top */
.navbar-container.fixed-top {
    z-index: 1030;
}


/* Navbar */
.navbar-container {
    opacity: 1;
    transform: translateY(0);
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out; /* Smooth transition for hiding/showing */
}
/* Keep navbar content on a single line and prevent wrapping */
.navbar .container { flex-wrap: nowrap !important; min-width: 0; }
.navbar .navbar-nav { flex-wrap: nowrap !important; gap: 0.35rem; }
.navbar .d-flex { flex-wrap: nowrap !important; }
.navbar .dropdown-menu { will-change: auto; }

/* Fluid scaling using clamp() so content shrinks instead of wrapping */
.navbar-brand span { font-size: clamp(1.1rem, 2.5vw, 1.4rem); /* Increased from 0.8-1.0rem to 1.1-1.4rem */ }
.navbar .logo-styled { width: clamp(45px, 9vw, 70px); /* Only width needs to be controlled */ }
.navbar .navbar-nav .nav-link { padding: 0.25rem clamp(0.3rem, 1.2vw, 0.5rem) !important; font-size: clamp(0.8rem, 1.8vw, 0.95rem); }
.navbar .btn.btn-sm { padding: 0.15rem clamp(0.3rem, 1.2vw, 0.5rem); font-size: clamp(0.7rem, 1.6vw, 0.85rem); }
.navbar .dropdown-toggle::after { margin-left: clamp(0.15rem, 0.8vw, 0.35rem); }

/* Desktop (md and up): shrink icons/text instead of wrapping */
@media (min-width: 768px) {
  .navbar .navbar-nav { gap: 0.4rem; }
}

/* Tighter layout at lg breakpoint */
@media (max-width: 1200px) and (min-width: 768px) {
  .navbar .navbar-nav { gap: 0.3rem; }
}

/* Mobile icon row (the d-md-none group): keep icons in a row without wrapping and size them down */
.navbar .d-md-none { flex-wrap: nowrap !important; gap: 0.25rem; }
.navbar .d-md-none .btn.btn-sm { padding: 0.2rem 0.35rem; font-size: 0.8rem; }
.navbar .d-md-none .btn .fas,
.navbar .d-md-none .btn .fa { font-size: 0.9rem; }

.navbar-container.navbar-hidden {
    opacity: 0;
    transform: translateY(-100%);
    pointer-events: none; /* Disable interaction when hidden */
}

.navbar-container .navbar {
    background-color: var(--navbar-bg); /* Set a default background color */
    padding: 1rem 0;
}

/* The simple navbars on login/register pages should have minimal padding */
.navbar:not(.navbar-container .navbar) {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.navbar.navbar-scrolled {
    background-color: var(--navbar-bg) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.navbar-dark .navbar-brand span {
    color: #f39c12 !important; /* Brighter Gold/Orange for better visibility */
    font-weight: bold;
}

.navbar-dark .nav-link {
    color: var(--accent-color-primary); /* Brighter color for dark mode */
}

.navbar-dark .nav-link:hover {
    color: var(--accent-color-primary) !important; /* Use a neon accent */
}

.dropdown-menu {
    background-color: var(--card-bg);
    border-color: var(--card-border-color);
}

.dropdown-item {
    color: var(--text-color);
}

.dropdown-item:hover {
    color: var(--accent-color) !important;
    background-color: rgba(212, 175, 55, 0.1);
}

/* Cards, Modals, List Groups */
.card, .modal-content, .list-group-item, .cta-section {
    background: var(--card-bg);
    backdrop-filter: blur(var(--card-blur));
    -webkit-backdrop-filter: blur(var(--card-blur)); /* For Safari */
    border: 1px solid var(--card-border-color);
    border-radius: 1rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    color: var(--text-color);
}

.hero-section-new {
    background: rgba(13, 17, 23, 0.6); /* Darker, more subtle glass */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden; /* Important for pseudo-element positioning */
    padding: 4rem 2rem !important; /* More padding */
}

.hero-section-new::before {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: -1;
    margin: -2px; /* To make the border appear outside */
    border-radius: inherit; /* Use the parent's border-radius */
    background: linear-gradient(45deg, var(--accent-color-secondary), var(--accent-color-primary));
    animation: gradientBG 10s ease infinite alternate;
    background-size: 200% 200%;
}

.hero-logo {
    width: 200px; /* Set fixed width */
    height: 200px; /* Set fixed height, equal to width */
    object-fit: cover; /* Prevent image distortion */
    border-radius: 50%;
    border: 4px solid #f39c12; /* Gold color - slightly thicker */
    box-shadow: 0 0 35px rgba(243, 156, 18, 0.7); /* Brighter gold glow */
}

/* --- Hero Logo Neon Hover Animation --- */
.hero-logo:hover {
    animation: borderColorChange 6s linear infinite, glowChange 6s linear infinite;
}

@keyframes borderColorChange {
    0%, 100% { border-color: var(--accent-color-primary); }
    33% { border-color: var(--accent-color-secondary); }
    66% { border-color: var(--accent-color-tertiary); }
}

@keyframes glowChange {
    0%, 100% { box-shadow: 0 0 35px var(--accent-color-primary); }
    33% { box-shadow: 0 0 35px var(--accent-color-secondary); }
    66% { box-shadow: 0 0 35px var(--accent-color-tertiary); }
}

/* --- Animated Gradient Border for Referral Image --- */
.animated-gradient-border {
    overflow: hidden; /* Ensures the ::before pseudo-element is clipped to the border-radius */
}

.animated-gradient-border::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0; /* Places the gradient behind the content */
    background: linear-gradient(
        45deg,
        var(--accent-color-primary),
        var(--accent-color-secondary),
        var(--accent-color-tertiary),
        var(--accent-color-primary)
    );
    background-size: 400% 400%;
    animation: gradientBG 10s ease infinite;
}

/* Ensure the actual content (the image overlay) stays on top of the gradient */
.animated-gradient-border .overlay-container {
    position: relative; /* Establishes a stacking context */
    z-index: 1; /* Sits on top of the ::before pseudo-element */
}

/* Back to Top Button */
#back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

/* Buttons */
.btn, a.btn {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 0.375rem;
}

.btn:hover, a.btn:hover {
    /* transform: translateY(-2px); */
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background-image: var(--btn-primary-bg);
    color: var(--btn-primary-text) !important;
    border: none;
    font-weight: bold;
    padding: 0.75rem 1.5rem;
}

.btn-primary:hover {
    /* transform: scale(1.05) translateY(-2px); */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.btn-outline-light {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border: 1px solid var(--btn-secondary-border);
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Tables */
.table {
    border-collapse: separate;
    border-spacing: 0 8px;
    width: 100%;
}

.table thead th {
    background-color: var(--table-header-bg);
    color: var(--table-header-text);
    border-bottom: 2px solid var(--accent-color);
    text-align: center;
    vertical-align: middle;
}

.table tbody tr {
    background-color: var(--table-row-bg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-radius: 8px;
}

.table tbody tr:hover {
    /* transform: translateY(-2px) scale(1.01); */
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    background-color: var(--table-row-hover-bg);
}

.table td, .table th {
    padding: 1rem;
    vertical-align: middle;
    border: none;
}

.table td:first-child, .table th:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.table td:last-child, .table th:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}


/* --- Custom styles for balance cards --- */
.rial-card.card {
    background-color: var(--bs-gray-700) !important; /* A darker, less prominent gray */
    border-color: var(--bs-gray-800) !important;
}

.rial-card .card-title,
.rial-card .currency-symbol {
    color: var(--bs-gray-400) !important; /* Lighter gray text for readability */
}

/* --- Homepage: Hero Slider Section --- */
.hero-slider-section .swiper-container {
    width: 100%;
    height: 100%;
}

.hero-slider-section .swiper-slide {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Style for Swiper Pagination */
.hero-swiper .swiper-pagination-bullet {
    background-color: rgba(255, 255, 255, 0.5);
    width: 10px;
    height: 10px;
    opacity: 0.8;
    border-radius: 50%; /* Ensure perfect circle */
    transition: background-color 0.3s ease; /* Only transition color */
}

.hero-swiper .swiper-pagination-bullet-active {
    background-color: var(--accent-color);
    /* transform property removed to stop animation */
}


/* --- Homepage: Hero Section (Inside Slider) --- */
.hero-section-new {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
    height: 450px; /* Set a fixed height */
    width: 100%; /* Set a fixed width to prevent horizontal resizing */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.hero-section-new h1, .hero-section-new p {
    color: inherit;
}

/* Adjust font sizes for better spacing in the hero section */
.hero-section-new h1.display-3 {
    font-size: 3rem; /* Further reduced for better fit */
}

.hero-section-new p.lead {
    font-size: 1.15rem; /* Further reduced for better fit */
    margin-bottom: 1.5rem !important; /* Reduced margin-bottom (mb-3) */
}

.hero-section-new .btn-outline-light {
    color: var(--text-color);
    border-color: var(--text-color);
}

.hero-section-new .btn-outline-light:hover {
    background-color: var(--text-color);
    color: var(--bg-color-mid);
}

.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem; /* Add space between the buttons */
    width: 100%;
}

/* Adjust hero button sizes */
.hero-section-new .btn.btn-lg {
    padding-top: 0.6rem; /* Reduced vertical padding */
    padding-bottom: 0.6rem;
    font-size: 1rem; /* Slightly smaller font */
    min-width: 220px; /* Set a minimum width for all slider buttons */
}

.hero-section-new .btn-primary.btn-lg {
    padding-left: 2.5rem; /* Increased horizontal padding for Get Started */
    padding-right: 2.5rem;
}

/* How It Works Section */
#how-it-works .card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border-color);
}

#how-it-works .card-title, #how-it-works .card-text {
    color: var(--text-color);
}

#how-it-works .step-circle-new {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: transparent;
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

/* CTA Section */
.cta-section {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
}

.cta-section h2, .cta-section p {
    color: inherit;
}

.auth-card .card-header {
    background-color: var(--accent-color);
    color: #000000; /* Black text on golden background for contrast */
    border-bottom: 2px solid var(--accent-color-darker);
    text-align: center;
    font-weight: bold;
}

/* --- Typewriter Effect --- */
.typing-effect::after {
    content: '';
}

/* @keyframes blink animation removed */

.auth-card .card-body {
    background-color: var(--card-hover-bg);
}

.auth-card .form-label {
    color: #ced4da; /* Even lighter text for better readability */
    font-weight: 500;
}

/* --- Utilities & Animations --- */

/* Back to Top Button */
#back-to-top {
    display: none; /* Hidden by default, shown by JS */
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 1000;
    background-color: var(--back-to-top-bg);
    color: var(--back-to-top-icon);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 20px;
    text-align: center;
    line-height: 50px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

#back-to-top:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    filter: brightness(1.1);
}

/* --- General Hover & Animation Effects --- */

/* Card hover effect */
.card, .feature-card {
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out;
}


/* Image hover effect */
img.img-fluid, .card-img-top {
    transition: transform 0.3s ease-in-out;
}

img.img-fluid:hover, .card-img-top:hover {
    transform: scale(1.05);
}

/* Form input focus effect */
.form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.25rem rgba(212, 175, 55, 0.25);
}

.wallet-icon {
    width: 28px; /* Adjust size as needed */
    height: 28px; /* Adjust size as needed */
    margin-right: 10px; /* Space between icon and title */
}

/* Shop Page Styles */
.product-card {
    background-color: #2c3e50;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    color: #ecf0f1;
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.product-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-info {
    padding: 20px;
    text-align: center;
}

.product-info h5 {
    color: #e67e22;
    margin-bottom: 15px;
    font-weight: bold;
}

.product-info p {
    font-size: 0.9rem;
    color: #bdc3c7;
}

.btn-primary-custom {
    background: linear-gradient(45deg, #e67e22, #f39c12);
    border: none;
    border-radius: 50px;
    padding: 10px 30px;
    color: white;
    font-weight: bold;
    transition: background 0.3s ease, transform 0.2s ease;
}

.btn-primary-custom:hover {
    background: linear-gradient(45deg, #f39c12, #e67e22);
    transform: scale(1.05);
}

/* Icon and simple link hover */
.social-icons a, .footer-links a {
    transition: transform 0.2s ease-in-out, color 0.2s ease-in-out;
}

.social-icons a:hover, .footer-links a:hover {
    transform: scale(1.15);
    color: var(--accent-color) !important;
}


/* Typing Animation */
.typing-subtitle {
    min-height: 3em; /* Reserve space for subtitle to prevent layout shift */
}

.typing-cursor::after {
    content: '|';
    display: inline-block;
    margin-left: 0.3rem;
    animation: blink 0.7s infinite;
    color: var(--accent-color);
}

@keyframes blink {
    50% { opacity: 0; }
}

/* --- Light Mode Theme --- */

/* Add smooth transitions for theme switching */
body, .navbar, .card, .modal-content, .site-footer, .dropdown-menu, .list-group-item, .product-card {
    transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease;
}

/* Specific overrides for light mode if variables are not enough */
html[data-bs-theme='light'] .navbar-dark .nav-link,
html[data-bs-theme='light'] .navbar-dark .navbar-brand span {
    color: #0056b3;
}

html[data-bs-theme='light'] .navbar-dark .nav-link:hover {
    color: var(--accent-color-primary) !important;
}

html[data-bs-theme='light'] .dropdown-item {
    color: var(--text-color);
}

html[data-bs-theme='light'] .dropdown-item:hover {
    color: var(--link-hover-color) !important;
    background-color: rgba(0, 123, 255, 0.1);
}

html[data-bs-theme='light'] .site-footer {
    background-color: #f8f9fa;
    color: #6c757d;
}

html[data-bs-theme='light'] .site-footer .footer-heading {
    color: #343a40;
}

html[data-bs-theme='light'] .site-footer a {
    color: #6c757d;
}

html[data-bs-theme='light'] .site-footer a:hover {
    color: #0056b3;
}

/* Developer Link Styling */
.developer-link {
    color: inherit;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
}

.developer-link:hover {
    color: var(--accent-color) !important;
    transform: translateY(-2px);
    text-decoration: none;
}

html[data-bs-theme='light'] .developer-link:hover {
    color: #0056b3 !important;
}

html[data-bs-theme='light'] .form-control {
    background-color: #fff;
    color: #212529;
    border-color: #ced4da;
}

html[data-bs-theme='light'] .form-control:focus {
    background-color: #fff;
    color: #212529;
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

html[data-bs-theme='light'] .form-control::placeholder {
    color: #6c757d;
}

html[data-bs-theme='light'] .auth-card .form-label {
    color: #495057;
}

html[data-bs-theme='light'] .product-card {
    background-color: #ffffff;
    color: #212529;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

html[data-bs-theme='light'] .product-info p {
    color: #6c757d;
}

/* Ensure light table headers have dark text in light mode and light text in dark mode */
[data-theme='dark'] .table-light th {
    color: var(--text-color);
}


/* Override for homepage cards in light mode */
html[data-bs-theme='light'] .feature-card,
html[data-bs-theme='light'] .step-card {
    background: var(--card-bg);
    border-color: var(--card-border-color);
}

/* Override for About Us section text in light mode */
html[data-bs-theme='light'] section .col-md-6 .lead {
    color: var(--secondary-text-color);
}

html[data-bs-theme='light'] section .col-md-6 h2,
html[data-bs-theme='light'] section .col-md-6 p:not(.lead) {
    color: var(--text-color);
}

/* Ensure table colors are correct in light mode */
html[data-bs-theme='light'] .table tbody tr,
html[data-bs-theme='light'] .table tbody tr td {
    background-color: var(--table-row-bg) !important;
    color: var(--text-color) !important;
}

html[data-bs-theme='light'] .table tbody tr:hover {
    background-color: var(--table-row-hover-bg) !important;
}

/* --- Hamburger Menu Customizations --- */
.navbar-toggler {
    border: 1px solid rgba(255, 255, 255, 0.2) !important; /* A visible border */
    padding: 0.25rem 0.5rem;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.25rem rgba(243, 156, 18, 0.5); /* Gold focus ring */
}

/* Customizing the toggler icon color for Dark Mode */
.navbar-dark .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28243, 156, 18, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Customizing the toggler icon color for Light Mode */
html[data-bs-theme='light'] .navbar-dark .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%280, 86, 179, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

html[data-bs-theme='light'] .navbar-toggler {
    border-color: rgba(0, 0, 0, 0.2) !important;
}



/* --- Homepage: Features Section Redesign -- */
.feature-card {
    background: rgba(22, 27, 34, 0.55); /* Slightly less opaque */
    backdrop-filter: blur(10px); /* More blur */
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 1rem;
    padding: 2rem 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden; /* To contain pseudo-elements if needed */
}

.feature-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 0 25px var(--accent-color-primary, #00f2ff);
}

.feature-icon-wrapper {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid;
    transition: all 0.3s ease;
}

.feature-card:hover .feature-icon-wrapper {
    transform: scale(1.1) rotate(10deg);
}

.feature-card .card-title {
    color: var(--text-color);
    font-weight: bold;
    margin-bottom: 0.75rem;
}

.feature-card .card-text {
    color: var(--secondary-text-color);
}

/* Assigning Neon Colors to Icons */
.feature-card .fa-shield-alt {
    color: var(--accent-color-primary);
}
.feature-card:hover .fa-shield-alt {
    text-shadow: 0 0 15px var(--accent-color-primary);
}
.feature-card .feature-icon-wrapper:has(.fa-shield-alt) {
    border-color: var(--accent-color-primary);
}

.feature-card .fa-chart-line {
    color: var(--accent-color-secondary);
}
.feature-card:hover .fa-chart-line {
    text-shadow: 0 0 15px var(--accent-color-secondary);
}
.feature-card .feature-icon-wrapper:has(.fa-chart-line) {
    border-color: var(--accent-color-secondary);
}

.feature-card .fa-headset {
    color: var(--accent-color-tertiary);
}
.feature-card:hover .fa-headset {
    text-shadow: 0 0 15px var(--accent-color-tertiary);
}
.feature-card .feature-icon-wrapper:has(.fa-headset) {
    border-color: var(--accent-color-tertiary);
}

/* --- Homepage: How It Works Section Redesign -- */
.step-card {
    background: rgba(22, 27, 34, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 1rem;
    padding: 2rem 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.step-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 0 25px var(--accent-color-secondary, #ff00e6);
}

.step-card .card-title {
    color: var(--text-color);
    font-weight: bold;
    margin-top: 1.5rem; /* Add space between circle and title */
}

.step-card .card-text {
    color: var(--secondary-text-color);
}


/* --- Shop Page: Product Cards --- */
.product-card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--card-blur));
    -webkit-backdrop-filter: blur(var(--card-blur));
    border: 1px solid var(--card-border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden; /* Ensures the image border-radius is respected */
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), 0 0 30px var(--accent-color-primary);
}

.product-image img {
    max-width: 100%;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--card-border-color);
}

.product-info h5 {
    color: var(--text-color);
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.product-info p {
    color: var(--secondary-text-color);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.btn-primary-custom {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    font-weight: bold;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary-custom:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--accent-color-secondary);
    color: var(--btn-primary-text);
}


/* --- Responsive Design --- */

/* 
  Force Navbar to expand on desktop widths, fixing 'Desktop Site' on mobile.
  This overrides Bootstrap's default behavior for .navbar-expand-lg
*/
@media (min-width: 992px) {
    .navbar-toggler {
        display: none !important;
    }
    .navbar-collapse {
        display: flex !important;
        flex-basis: auto;
    }
    .navbar-nav {
        flex-direction: row !important;
    }
    .navbar-nav .nav-link {
        padding-right: .5rem !important;
        padding-left: .5rem !important;
    }
}


@media (max-width: 992px) {
    .hero-section-new h1 { font-size: 2.5rem; }
    .admin-panel-container { padding: 1.5rem; }
}

@media (max-width: 767.98px) {
    /* --- Dashboard Mobile Slide-in Menu Overlay --- */
    .dashboard-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.35s ease, visibility 0.35s ease;
    }

    .dashboard-menu-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    /* --- Close button inside the menu --- */
    .btn-close-menu {
        position: absolute;
        top: 1rem;
        right: 1rem;
    }

    /* Dashboard mobile menu - handled by media query below */
    #v-pills-tab .nav-link {
        text-align: left;
        width: 100%;
    }
}

@media (max-width: 768px) {
    /* Body padding handled above */
    .hero-section-new { 
        padding: 2.5rem 1rem !important; /* Reduced padding */
        height: 480px; /* Set a fixed height for mobile to contain text */
    }
   .hero-section-new h1.display-3 { font-size: 2.0rem; }
   .hero-section-new p.lead { font-size: 1.0rem; }
    .feature-card, .card { margin-bottom: 1.5rem; }
    .footer-heading { margin-top: 1rem; }
    .navbar-collapse {
        background-color: var(--bg-color-mid); /* Solid background for dark mode */
        padding: 1rem;
        border-radius: 0.5rem;
        margin-top: 0.5rem;
        border: 1px solid var(--card-border-color);
    }

    html[data-bs-theme='light'] .navbar-collapse {
        background-color: var(--bg-color); /* Solid background for light mode */
        border-color: var(--card-border-color);
    }
    .table-responsive { border: 1px solid var(--card-border-color); border-radius: 8px; }
    .admin-panel-container h1 { font-size: 1.8rem; }
    .auth-card { padding: 1.5rem; }
}

@media (max-width: 576px) {
    .hero-buttons {
        flex-direction: row; /* Keep buttons side-by-side */
        justify-content: center;
    }
    .hero-section-new .btn.btn-lg {
        min-width: unset; /* Remove min-width on mobile */
        width: calc(50% - 0.5rem); /* Half width minus half the gap */
        padding-left: 0.5rem; /* Adjust padding to fit text */
        padding-right: 0.5rem;
    }
    .hero-section-new h1.display-3 { font-size: 1.8rem; }
    .hero-section-new p.lead { font-size: 0.9rem; }
   section {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }

    .container {
        padding-left: 20px;
        padding-right: 20px;
    }

    h1, .h1 { font-size: 2rem; }
    h2, .h2 { font-size: 1.6rem; }

    .hero-logo {
        max-width: 140px; /* Adjust hero logo for smaller screens */
        width: 140px;
        height: 140px;
    }

    .hero-section-new .btn {
        display: block;
        width: 100%;
        margin-bottom: 0.5rem;
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    .hero-section-new .btn-lg.me-2 { margin-right: 0 !important; }
    .cta-section { padding: 2.5rem 1rem !important; }
    .cta-section h2 { font-size: 1.6rem; }
    .auth-card .card-body { padding: 1.5rem; }
}

/* Unify table background color to prevent theme overrides in all languages */
.table tbody tr,
.table tbody tr td {
    background-color: var(--table-row-bg) !important;
    color: var(--text-color) !important;
}

.table tbody tr:hover {
    background-color: var(--table-row-hover-bg) !important;
}

/* --- Navbar Brand & Logo Final Fix --- */
.navbar-brand {
    cursor: pointer;
}

/* Force disable hover effects on navbar logo and text */
/* --- Navbar Brand & Logo Final, Definitive Fix --- */
/* This rule targets the link container itself to prevent ANY transform on hover or click. */
.navbar-brand:hover,
.navbar-brand:active {
    transform: none !important; /* Prevents scaling on the container */
}

/* This ensures the text color remains static and does not change on hover or click. */
.navbar-brand:hover span,
.navbar-brand:active span {
    color: #f39c12 !important;
}

/* --- General Body & Links --- */
.main-content {
    padding-top: 0; /* Removed - body already has padding */
}

/* --- General Styled Logo (Final, Robust Fix) --- */
.logo-styled {
    /* Use aspect-ratio to guarantee a perfect circle */
    aspect-ratio: 1 / 1; /* Guarantees the element is always a square */
    height: auto; /* Allow height to be determined by aspect-ratio */
    object-fit: cover; /* Prevents image distortion */
    border-radius: 50%;
    border: 3px solid var(--accent-color-primary, #00f2ff);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.6);
    padding: 2px; /* Small padding to prevent border from touching the image */
    background-color: var(--navbar-bg); /* To prevent content behind from showing */
}



/* --- Mobile Dashboard Menu Toggle --- */
@media (max-width: 767px) {
    .mobile-menu-toggle-container {
        position: relative !important;
        z-index: 1060;
        background-color: var(--body-bg);
        padding: 8px;
        margin-bottom: 15px;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        display: inline-block;
    }

    /* LTR (English): Left side */
    [dir="ltr"] .mobile-menu-toggle-container {
        text-align: left;
    }

    /* RTL (Persian): Right side */
    [dir="rtl"] .mobile-menu-toggle-container {
        text-align: right;
    }

    /* No need to push Dashboard title down anymore */
    .dashboard-header {
        margin-top: 0 !important;
    }
}

/* Dashboard sidebar menu overlay - Mobile only */
@media (max-width: 767px) {
    #v-pills-tab {
        display: flex !important;
        position: fixed;
        top: 0;
        left: -100%; /* Hidden by default */
        width: 280px;
        height: 100vh;
        background-color: var(--card-bg);
        z-index: 1070; /* Above everything including hamburger button */
        transition: left 0.3s ease-in-out;
        overflow-y: auto;
        padding: 1.5rem;
        padding-top: 70px; /* Space for navbar */
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
        flex-direction: column;
    }

    [dir="rtl"] #v-pills-tab {
        left: auto;
        right: -100%;
        transition: right 0.3s ease-in-out;
    }

    /* When menu is open */
    #v-pills-tab.show {
        left: 0;
    }

    [dir="rtl"] #v-pills-tab.show {
        right: 0;
    }
}

/* Backdrop overlay */
.menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1065; /* Below menu but above everything else */
    display: none;
}

.menu-backdrop.show {
    display: block;
}

/* --- Cosmic Gateway Auth Page Design --- */

.auth-body {
    padding-top: 0; /* Remove padding from old fixed navbar */
    overflow: hidden; /* Prevent scrollbars from the container */
}

.auth-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* Left Panel (Branding) */
.auth-branding-panel {
    width: 45%;
    background-color: #0d1117; /* Fallback color */
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden; /* For pseudo-elements */
    background-image: linear-gradient(135deg, var(--bg-color-start), var(--bg-color-mid));
}

.auth-branding-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url('assets/img/stars.png'); /* Add your star texture image here */
    background-size: cover;
    animation: space-travel 60s linear infinite;
    opacity: 0.3;
}

@keyframes space-travel {
    from { transform: translateY(0); }
    to { transform: translateY(-500px); }
}

.auth-branding-content {
    text-align: center;
    z-index: 1;
}

.auth-logo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 4px solid var(--accent-color-primary);
    margin-bottom: 2rem;
    box-shadow: 0 0 30px var(--accent-color-primary);
}

.auth-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.auth-tagline {
    font-size: 1.1rem;
    color: var(--secondary-text-color);
    max-width: 400px;
    margin: 0 auto 2rem auto;
}

.auth-features {
    list-style: none;
    padding: 0;
    text-align: left;
    display: inline-block;
}

.auth-features li {
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.auth-features .fa-check-circle {
    color: var(--accent-color-primary);
    margin-right: 10px;
}

.auth-lang-theme-controls {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1rem;
}

/* Right Panel (Form) */
.auth-form-panel {
    width: 55%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: var(--card-bg);
    backdrop-filter: blur(var(--card-blur));
    -webkit-backdrop-filter: blur(var(--card-blur));
}

.auth-form-content {
    width: 100%;
    max-width: 450px;
}

.auth-form-header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

.auth-form-header h2 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.auth-home-link {
    position: absolute;
    top: -40px;
    right: 0;
    color: var(--secondary-text-color);
    text-decoration: none;
    transition: color 0.3s ease;
}
.auth-home-link:hover {
    color: var(--link-hover-color);
}

/* --- Animated Gradient Text --- */
.animated-gradient-text {
    background: linear-gradient(45deg, var(--accent-color-primary), var(--accent-color-secondary), var(--accent-color-tertiary));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-animation 5s ease infinite;
}

@keyframes gradient-animation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- Ensure the impersonation alert is always on top */
.impersonation-alert {
    position: relative; /* Required for z-index to work */
    z-index: 1050; /* Higher than the navbar's default z-index */
}

/* Responsive adjustments for smaller screens */
@media (max-width: 767.98px) {
    .auth-body {
        overflow: auto; /* Allow scrolling on mobile */
    }
    .auth-container {
        flex-direction: column;
        height: auto; /* Allow content to determine height */
        min-height: 100vh;
    }

    /* Mobile Header (Branding) */
    .auth-branding-panel {
        width: 100%;
        height: auto;
        padding: 2rem 1.5rem;
        text-align: center;
        flex-shrink: 0; /* Prevent header from shrinking */
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    }
    .auth-logo { 
        width: 80px; 
        height: 80px; 
        margin-bottom: 1rem; 
        border-width: 3px;
        box-shadow: 0 0 20px var(--accent-color-primary);
    }
    .auth-title { font-size: 1.5rem; }
    .auth-tagline, .auth-features { display: none; } /* Hide for cleaner mobile view */
    .auth-lang-theme-controls { 
        position: static; 
        transform: none; 
        margin-top: 1rem; 
        justify-content: center; 
    }

    /* Mobile Form Panel */
    .auth-form-panel {
        width: 100%;
        flex-grow: 1; 
        padding: 2.5rem 1.5rem; /* More vertical padding */
        align-items: flex-start; 
        overflow-y: visible; /* Let the body handle scrolling */
}

/* General Card Styles */
.card {
    border: none; /* Optional: remove default borders */
}

/* Custom class to center content in balance cards */
.balance-card-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%; /* Ensure the body takes full height of the card */
}

.auth-home-link { 
    top: -1rem; /* Adjust position */
    right: 0;
    font-size: 0.9rem;
}

.auth-form-header h2 {
    font-size: 1.8rem; /* Slightly smaller title in form */
}

/* --- Referral Page Enhancements --- */
#v-pills-referrals .card-header {
    background-color: var(--bs-light);
    border-bottom: 1px solid var(--bs-border-color);
}

#v-pills-referrals .table {
    margin-bottom: 0; /* Remove default bottom margin from table inside card */
}

#v-pills-referrals .table thead {
    background-color: rgba(0, 0, 0, 0.2);
}


/* --- Auth Page Navbar Height Override --- */
.auth-navbar {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    min-height: auto !important;
}

@media (max-width: 576px) {
    .balance-card { height: auto; } /* Let cards expand naturally on small screens */
}

/* --- Animated Gradient Text for Usernames --- */
.animated-gradient-text {
    font-weight: bold;
    background: linear-gradient(90deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-animation 5s linear infinite;
    display: inline-block; /* Ensures the gradient applies correctly */
}

@keyframes gradient-animation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.welcome-message {
    text-align: center;
    margin-bottom: 1.5rem;
}

/* --- Currency symbol badges (for TRX, DOGE, BTC, Rial) --- */
.currency-symbol, .symbol-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-weight: 700;
    line-height: 1;
}
.symbol-badge {
    background: rgba(255,255,255,0.15);
    border-radius: 6px;
    padding: 0 6px;
    font-size: 0.9rem;
}

/* Image-based currency icon */
.coin-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

/* --- Custom Animations --- */

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes borderColorChange {
  0%, 100% { border-color: #f39c12; }
  33% { border-color: var(--accent-color-primary); }
  66% { border-color: var(--accent-color-secondary); }
}

@keyframes glowChange {
  0%, 100% { box-shadow: 0 0 20px rgba(243, 156, 18, 0.6); }
  33% { box-shadow: 0 0 25px var(--accent-color-primary); }
  66% { box-shadow: 0 0 25px var(--accent-color-secondary); }
}

@keyframes textColorChange {
  0%, 100% { color: #f39c12; }
  33% { color: var(--accent-color-primary); }
  66% { color: var(--accent-color-secondary); }
}

/* Applying animations */
.navbar-logo-img, .hero-logo {
  transition: transform 0.5s ease-in-out;
  border-radius: 50%; /* Ensure navbar logo is also circular for animation */
}

.navbar-brand:hover .navbar-logo-img,

/* --- Swiper Navigation Button Visibility Fix --- */
.swiper-button-next, .swiper-button-prev {
    display: flex !important; /* Ensure they are always displayed */
    opacity: 1 !important; /* Ensure they are fully visible */
    visibility: visible !important; /* Ensure they are not hidden */
}

/* --- Mobile Dashboard Menu Auto-close --- */
.mobile-menu-toggle-container .btn {
    font-size: 1.25rem; /* Make the icon a bit bigger */
    padding: 0.5rem 0.75rem;
}


/* --- Back to Top Button --- */
#back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: var(--accent-color);
    color: white;
    text-align: center;
    line-height: 40px;
    border-radius: 50%;
    z-index: 1050; /* Higher than navbar (1030) and other elements */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    transform: translateY(10px);
}

#back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

#back-to-top:hover {
    background-color: var(--accent-color-darker);
}

/* Custom styles for compact table in admin settings */
.table-compact th,
.table-compact td {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.navbar-brand span {
    display: inline-block; /* Needed for transform to work correctly */
    transition: color 0.5s ease-in-out;
}

.navbar-brand:hover span {
  animation: textColorChange 6s linear infinite;
}


/* Lock page scroll while intro is shown */
html.lock-scroll,
body.lock-scroll {
  overflow: hidden !important;
}

/* --- Sticky footer: footer stays at bottom when content is short --- */
/* Body is already a flex column earlier; avoid re-declaring heights that break mobile */

/* --- Referral Tree Styles --- */
.referral-tree-container {
    overflow-x: auto; /* Allows scrolling for large trees */
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 1rem;
    border: 1px solid var(--card-border-color);
}

.referral-tree {
    white-space: normal; /* Allow wrapping so items stack vertically */
    margin: 0 auto;
    text-align: center;
}

.referral-tree ul {
    padding-top: 20px;
    position: relative;
    transition: all 0.5s;
    margin: 0;
}

.referral-tree li {
    display: block; /* Stack nodes vertically */
    text-align: center;
    list-style-type: none;
    position: relative;
    padding: 20px 0 0 0;
    transition: all 0.5s;
}

/* Extra safety overrides so that desktop and mobile look the same */
#v-pills-referrals .referral-tree ul {
    list-style: none !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
}

#v-pills-referrals .referral-tree li {
    list-style: none !important;
    margin-left: 0 !important;
}

/* Connecting lines - simple vertical connectors between nodes */
.referral-tree li::before,
.referral-tree li::after {
    content: '';
    position: absolute;
    left: 50%;
    width: 0;
    border-left: 2px solid var(--card-border-color);
}

/* Line from parent down into current node */
.referral-tree li::before {
    top: -20px;
    height: 20px;
}

/* Line from current node down to its children */
.referral-tree li::after {
    top: 100%;
    height: 20px;
}

/* Remove top line for first node and bottom line for last node in each list */
.referral-tree li:first-child::before {
    display: none;
}

.referral-tree li:last-child::after {
    display: none;
}

.referral-tree ul ul::before {
    display: none; /* Not needed in vertical layout */
}

/* User node styling */
.user-node {
    padding: 15px;
    text-decoration: none;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    border: 1px solid var(--card-border-color);
    border-radius: 8px;
    display: inline-block;
    min-width: 200px;
    transition: all 0.3s;
}

.user-node.current-user {
    background-color: var(--accent-color-primary);
    color: #000;
    border-color: var(--accent-color-primary);
}

.user-node:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.user-node strong {
    display: block;
    font-size: 1.1rem;
}

/* --- Edge-to-edge layout on small screens (incl. Desktop Site on mobile) --- */
@media (max-width: 991.98px) {
    /* Make all containers full-width but keep small side padding for readability */
  }
/* --- Compact List Balance Cards --- */
.compact-list-card {
    min-height: 80px; /* Set a minimum height */
    height: auto; /* Allow it to grow if needed */
}

.compact-list-card .card-body {
    padding: 1rem; /* Adjust padding */
}

.compact-list-card .fas {
    font-size: 1.75rem; /* Icon size */
}

.compact-list-card .card-title {
    font-size: 0.9rem; /* Title font size */
}

.compact-list-card .card-text {
    font-size: 1.1rem; /* Number font size */
}


/* --- Compact Recent Transactions Card --- */
.compact-transactions-card .card-header,
.compact-transactions-card .card-footer {
    padding: 0.5rem 1rem;
}

.compact-transactions-card .table th,
.compact-transactions-card .table td {
    padding: 0.5rem;
    font-size: 0.875rem;
}

.compact-transactions-card .alert {
    padding: 0.75rem;
    margin: 0.75rem !important;
}


/* --- Mobile Navigation Z-Index Hierarchy --- */

/* 1. Main Navbar's Hamburger Menu (Top Layer) */
.navbar-collapse.show,
.navbar-collapse.collapsing {
    z-index: 1060 !important;
    position: relative;
    background-color: var(--navbar-bg); /* Ensure it has a solid background */
    padding: 1rem;
    margin-top: 0.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--card-border-color);
}

/* 2. Dashboard's Slide-in Menu - handled above */

/* 3. Dashboard's Hamburger Button - Removed duplicate definition */

/* 4. Second Profile Bar */
.mobile-profile-bar {
    position: relative; /* Needed for z-index to apply */
    z-index: 1040;
}


/* --- New Mobile Navigation (Top & Bottom Bars) --- */

/* Add padding to the body to prevent content from being hidden by the bottom nav */
@media (max-width: 767.98px) {
    body {
        padding-bottom: 70px; /* Adjust based on nav height */
        /* padding-top handled in main body styles above */
    }
}

.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background-color: var(--navbar-bg);
    border-top: 1px solid var(--card-border-color);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
    padding: 0.5rem 0;
}

.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--secondary-text-color);
    font-size: 0.75rem;
    flex-grow: 1;
    transition: color 0.2s ease-in-out;
}

.mobile-bottom-nav .nav-item i {
    font-size: 1.25rem;
    margin-bottom: 4px;
}

.mobile-bottom-nav .nav-item.active,
.mobile-bottom-nav .nav-item:hover {
    color: var(--accent-color-primary);
}

/* --- News Section --- */
#news-section {
    background-color: var(--card-bg);
    border-top: 1px solid var(--card-border-color);
}

.news-tabs {
    border-bottom: 1px solid var(--card-border-color);
}

.news-tabs .nav-link {
    color: var(--secondary-text-color);
    border: none;
    border-bottom: 3px solid transparent;
    padding: 1rem 0.5rem;
    margin: 0 1rem;
}

.news-tabs .nav-link.active {
    color: var(--text-color);
    background-color: transparent;
    border-bottom: 3px solid var(--accent-color-primary);
}

.news-date-header {
    display: flex;
    align-items: center;
    justify-content: flex-end; /* Align to the right for RTL */
    color: var(--text-color);
    font-weight: bold;
}

.live-dot {
    width: 8px;
    height: 8px;
    background-color: #28a745; /* Green dot */
    border-radius: 50%;
    margin-left: 0.5rem; /* RTL: margin-left */
    animation: blink 1.5s infinite;
}

.news-list .list-group-item {
    background-color: transparent;
    border-color: var(--card-border-color);
    color: var(--text-color);
    padding: 1rem 0;
}

.news-list .list-group-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.news-title {
    font-size: 1rem;
    font-weight: 500;
}

.news-time {
    font-size: 0.85rem;
}

html[dir="ltr"] .news-date-header {
    justify-content: flex-start;
}

html[dir="ltr"] .live-dot {
    margin-left: 0;
    margin-right: 0.5rem;
}

.quick-access-menu .dropdown-menu {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border-color);
}

.quick-access-menu .dropdown-item {
    color: var(--secondary-text-color);
}

.quick-access-menu .dropdown-item:hover {
    background-color: var(--accent-color-primary);
    color: #fff;
}

/* --- Quick Access Menu --- */
.quick-access-menu {
    background-color: var(--card-bg); /* Use card background for consistency */
    border-bottom: 1px solid var(--card-border-color);
}

.quick-access-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--secondary-text-color);
    position: relative; /* For the 'new' badge */
    transition: color 0.3s ease, transform 0.3s ease;
}

.quick-access-item:hover {
    color: var(--accent-color-primary);
    transform: translateY(-5px);
}

.quick-access-item i {
    margin-bottom: 0.5rem;
}

.quick-access-item span {
    font-size: 0.85rem;
    font-weight: 500;
}

.quick-access-item.new-feature::after {
    content: 'جدید';
    position: absolute;
    top: -5px;
    right: 0;
    background-color: #28a745; /* Green background for 'new' */
    color: #fff;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: bold;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* --- Impersonation Banner --- */
.impersonation-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100; /* Highest z-index to be on top of everything */
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    border-bottom: 2px solid #ffc107 !important; /* Accent border */
    background-color: rgba(33, 37, 41, 0.95) !important; /* Dark, slightly transparent background */
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.impersonation-banner span {
    font-weight: bold;
}

.impersonation-banner .btn-warning {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #000;
    font-weight: bold;
}

/* --- Referral Tree Styles (Image-Based Design) --- */
.referral-tree-container {
    overflow-x: auto;
    padding: 1rem;
    background-color: var(--bs-tertiary-bg);
    border-radius: 0.5rem;
    text-align: center;
}

.tree ul {
    padding-top: 20px;
    position: relative;
    display: inline-flex;
}

.tree li {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    list-style-type: none;
    position: relative;
    padding: 20px 5px 0 5px;
}

/* Connectors */
.tree li::before, .tree li::after {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    border-top: 2px solid #28a745; /* Green color */
    width: 50%;
    height: 40px; /* Adjust to center of the node */
}

.tree li::after {
    right: auto;
    left: 50%;
    border-left: 2px solid #28a745;
}

.tree li:only-child::after, .tree li:only-child::before { display: none; }
.tree li:only-child { padding-top: 0; }
.tree li:first-child::before, .tree li:last-child::after { border: 0 none; }

.tree li:last-child::before {
    border-right: 2px solid #28a745;
    border-radius: 0 5px 0 0;
}

.tree li:first-child::after { border-radius: 5px 0 0 0; }

.tree ul ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid #28a745;
    width: 0;
    height: 20px;
}

/* Node Style with Image */
.tree .node {
    width: 80px;
    height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--bs-body-color);
    font-weight: bold;
    margin: 0 auto;
    background-image: url('../img/refral.jpg');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border: none !important;
    background-color: transparent !important;
}

.tree .node .username {
    font-size: 0.8rem;
    color: var(--bs-emphasis-color);
    margin-top: 5px;
}

/* --- Skeleton Loading --- */
@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

.skeleton {
    position: relative;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.1); /* Base color for skeleton elements */
}

.skeleton::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.2) 20%,
        rgba(255, 255, 255, 0.5) 60%,
        rgba(255, 255, 255, 0)
    );
    animation: shimmer 2s infinite;
    content: '';
}

body.skeleton-active .skeleton-text {
    color: transparent !important;
    user-select: none;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    display: inline-block;
}

/* Hide icons inside skeleton text */
body.skeleton-active .skeleton-text i {
    display: none;
}

/* Specific sizes for text elements */
body.skeleton-active h3.skeleton-text { width: 40%; height: 1.75rem; }
body.skeleton-active h5.skeleton-text { width: 30%; height: 1.25rem; }
body.skeleton-active p.skeleton-text { width: 100%; height: 1rem; }
body.skeleton-active .display-4.skeleton-text { width: 60%; height: 3rem; margin: 0 auto; }

/* Make cards skeleton */
body.skeleton-active .card.skeleton-card {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

body.skeleton-active .card.skeleton-card * {
    visibility: hidden;
}

body.skeleton-active .card.skeleton-card .skeleton-content {
    visibility: visible;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
}

body.skeleton-active .card.skeleton-card .skeleton-content .skeleton-placeholder {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.tree .node .user-id {
    font-size: 0.7rem;
    opacity: 0.8;
    color: var(--bs-secondary-color);
}
