/* سبک دارک مود که تنها رنگ‌ها را بازنویسی می‌کند و بر لایت‌تِم سوار می‌شود */

[data-bs-theme="dark"] {
    color-scheme: dark;
    --theme-primary: #8b5cf6;
    --theme-primary-dark: #7c3aed;
    --theme-accent: #38bdf8;
    --theme-surface: #0f172a;
    --theme-surface-muted: #111c30;
    --theme-surface-elevated: #16213d;
    --theme-surface-contrast: #1d2a4a;
    --theme-text: #e2e8f0;
    --theme-text-muted: #94a3b8;
    --theme-border: rgba(148, 163, 184, 0.28);
    --theme-border-strong: rgba(148, 163, 184, 0.45);
    --theme-shadow: 0 20px 45px rgba(8, 12, 24, 0.6);
    --theme-highlight: rgba(139, 92, 246, 0.22);
    --theme-overlay: rgba(56, 189, 248, 0.3);

    --bs-primary-text-emphasis: #ddceff;
    --bs-primary-bg-subtle: #241c5b;
    --bs-body-bg: var(--theme-surface);

    .accordion {
        --bs-accordion-btn-focus-border-color: var(--theme-primary-dark);
        --bs-accordion-btn-focus-box-shadow: 0 0 0 0.25rem rgb(172 13 253 / 25%);
    }

    /* other Bootstrap color variables - by chatGPT */
    --bs-body-color: var(--theme-text);
    --bs-body-color-muted: var(--theme-text-muted);

    --bs-primary: var(--theme-primary);
    --bs-primary-rgb: 139,
    92,
    246;

    --bs-info: var(--theme-accent);
    --bs-info-rgb: 56,
    189,
    248;

    --bs-secondary: #64748b;
    --bs-secondary-rgb: 100,
    116,
    139;

    --bs-success: #10b981;
    --bs-success-rgb: 16,
    185,
    129;

    --bs-warning: #fbbf24;
    --bs-warning-rgb: 251,
    191,
    36;

    --bs-danger: #f43f5e;
    --bs-danger-rgb: 244,
    63,
    94;

    --bs-light: #1d2a4a;
    --bs-light-rgb: 29,
    42,
    74;

    --bs-dark: #0f172a;
    --bs-dark-rgb: 15,
    23,
    42;

    --bs-border-color: var(--theme-border);
    --bs-border-color-translucent: var(--theme-border-strong);

    --bs-tertiary-bg: var(--theme-surface-muted);
    --bs-secondary-bg: var(--theme-surface-elevated);
    --bs-secondary-bg-subtle: var(--theme-surface-contrast);

    --bs-heading-color: var(--theme-text);
    --bs-link-color: var(--theme-accent);
    --bs-link-hover-color: color-mix(in srgb, var(--theme-accent) 80%, white);
    --bs-link-visited-color: var(--theme-primary-dark);

    --bs-highlight-bg: var(--theme-highlight);
    --bs-backdrop-bg: var(--theme-overlay);
    --bs-box-shadow: var(--theme-shadow);
    --bs-focus-ring-color: var(--theme-primary-dark);
    /* END OF other Bootstrap color variables - by chatGPT */

    .list-group {
        --bs-list-group-active-bg: var(--theme-primary-dark);
        --bs-list-group-active-border-color: var(--theme-primary-dark);
    }

    body {
        background: linear-gradient(180deg, #0b1220 0%, var(--theme-surface) 55%, #111c30 100%);
        color: var(--theme-text);
    }

    a:not(.btn, .list-group-item) {
        color: var(--theme-accent);

        &:hover,
        &:focus {
            color: var(--theme-primary);
        }
    }

    .bg-surface-muted {
        background-color: var(--theme-surface-muted);
    }

    .navbar {
        background: rgba(12, 18, 34, 0.92) !important;
    }

    .navbar-brand {
        color: var(--theme-text) !important;
    }

    .navbar {
        .navbar-brand {

            &:focus,
            &:hover {
                color: var(--theme-text) !important;
            }
        }

        .nav-link,
        .dropdown-item,
        .dropdown-item-text {
            color: var(--theme-text) !important;
        }

        .nav-link {

            &.active,
            &:hover {
                color: var(--theme-primary) !important;
            }

            &.active {
                background: linear-gradient(135deg, rgba(124, 58, 237, 0.38), rgba(56, 189, 248, 0.28));
                color: var(--theme-surface) !important;
                border-radius: 0.75rem;
                box-shadow: 0 14px 32px rgba(8, 12, 24, 0.55);

                i {
                    color: var(--theme-surface) !important;
                }
            }
        }

        .dropdown-item {

            &:hover,
            &:focus {
                color: var(--theme-primary) !important;
                background-color: var(--theme-highlight);
            }
        }

        .dropdown-menu {
            background-color: var(--theme-surface-elevated);
            border: 1px solid var(--theme-border);
            box-shadow: var(--theme-shadow);
        }
    }

    &.navbar-dark,
    .navbar-dark {
        .navbar-toggler {
            border: none;

            &:focus {
                box-shadow: 0 0 0 0.2rem var(--theme-overlay);
            }
        }

        .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(226,232,240,0.85)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
        }
    }

    .btn-warning {
        box-shadow: 0 14px 28px rgb(255 193 7 / 7%);
    }

    .welcome-card {
        background: rgba(15, 23, 42, 0.92);
        border: 1px solid var(--theme-border);
        box-shadow: var(--theme-shadow);
        padding: 1.25rem;

        .feature-item {
            background: rgba(30, 41, 59, 0.7);
            border: 1px solid rgba(124, 58, 237, 0.25);
            border-radius: 1.25rem;
            padding: 1.5rem 1.25rem;
            box-shadow: 0 14px 32px rgba(8, 12, 24, 0.55);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 0.75rem;
            height: 100%;
            transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;

            &:hover {
                transform: translateY(-6px);
                box-shadow: 0 24px 48px rgba(124, 58, 237, 0.45);
                border-color: rgba(124, 58, 237, 0.45);
            }

            i {
                width: 64px;
                height: 64px;
                border-radius: 50%;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                background: rgba(124, 58, 237, 0.18);
            }

            h5 {
                margin-bottom: 0;
                color: rgba(224, 231, 255, 0.95);
            }

            p {
                margin-bottom: 0;
                color: rgba(148, 163, 184, 0.92);
            }
        }
    }

    .credit-status-card {
        background: rgba(15, 23, 42, 0.65);
        border: 1px solid rgba(124, 58, 237, 0.28);
        border-radius: 1.25rem;
        padding: 1.5rem;
        box-shadow: 0 14px 32px rgba(8, 12, 24, 0.48);

        &::after {
            content: none;
        }
    }

    .credit-status-hero {
        display: flex;
        gap: 1rem;
        align-items: flex-start;
    }

    .credit-status-icon {
        width: 48px;
        height: 48px;
        border-radius: 1rem;
        background: rgba(124, 58, 237, 0.25);
        color: rgba(224, 231, 255, 0.95);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 1.4rem;
        box-shadow: none;
    }

    .credit-status-badge {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        padding: 0.2rem 0.65rem;
        background: rgba(124, 58, 237, 0.22);
        color: rgba(224, 231, 255, 0.92);
        font-size: 0.8rem;
        font-weight: 600;
        border-radius: 999px;
        box-shadow: none;
    }

    .credit-status-title {
        font-weight: 700;
        color: rgba(224, 231, 255, 0.95);
    }

    .credit-status-meta {
        color: rgba(148, 163, 184, 0.85);
        font-size: 0.85rem;
    }

    .credit-progress {
        margin-top: 1.25rem;
    }

    .credit-progress-track {
        position: relative;
        height: 0.55rem;
        border-radius: 999px;
        background: rgba(124, 58, 237, 0.25);
        overflow: hidden;

        &::after {
            content: '';
            position: absolute;
            inset: 0;
            width: var(--progress);
            background: linear-gradient(90deg, rgba(124, 58, 237, 0.85), rgba(56, 189, 248, 0.8));
            border-radius: inherit;
            transition: width 0.4s ease;
        }
    }

    .credit-progress-labels {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 0.8rem;
        color: rgba(148, 163, 184, 0.85);
        margin-top: 0.6rem;
        font-weight: 500;
    }

    .credit-stat-card {
        background: rgba(17, 24, 39, 0.72);
        border-radius: 1rem;
        padding: 1rem 1.1rem;
        border: 1px solid rgba(124, 58, 237, 0.2);
        box-shadow: none;

        &.primary {
            background: rgba(124, 58, 237, 0.22);
        }

        &.subtle {
            background: rgba(15, 23, 42, 0.64);
        }
    }

    .credit-status-card .row.g-3 > [class*="col-"] {
        display: flex;
    }

    .credit-status-card .credit-stat-card {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .credit-stat-label {
        color: rgba(224, 231, 255, 0.88);
    }

    .credit-stat-value {
        color: rgba(224, 231, 255, 0.95);
    }

    .credit-stat-card.primary {

        .credit-stat-label,
        .credit-stat-hint {
            color: rgba(224, 231, 255, 0.92);
        }
    }

    .credit-stat-hint {
        font-size: 0.75rem;
        color: rgba(148, 163, 184, 0.8);
    }

    .credit-status-footer {
        margin-top: 1.25rem;
        display: flex;
        flex-wrap: wrap;
        gap: 0.75rem;
        justify-content: space-between;
        align-items: center;
    }

    .credit-status-tip {
        color: rgba(148, 163, 184, 0.85);
    }

    .btn-credit-upgrade {
        border-radius: 0.75rem;
        padding-inline: 1.3rem;
        padding-block: 0.5rem;
        font-weight: 600;
        box-shadow: none;

        &:hover,
        &:focus {
            box-shadow: none;
        }
    }

    .start-button {
        background: linear-gradient(135deg, var(--theme-primary) 0%, var(--theme-accent) 100%);
        box-shadow: 0 16px 30px rgba(124, 58, 237, 0.4);
        border: none;

        &:hover,
        &:focus {
            box-shadow: 0 22px 45px rgba(124, 58, 237, 0.5);
        }
    }

    .card,
    .category-widget,
    .related-posts .card,
    .blog-card,
    section .card {
        background-color: var(--theme-surface-elevated);
        border: 1px solid var(--theme-border);
        box-shadow: 0 12px 28px rgba(8, 12, 24, 0.45);
        color: var(--theme-text);
    }

    .btn-primary {
        background: linear-gradient(135deg, var(--theme-primary) 0%, var(--theme-accent) 100%);
        border: none;
        box-shadow: 0 14px 28px rgba(124, 58, 237, 0.35);

        &:hover,
        &:focus {
            background: linear-gradient(135deg, var(--theme-primary-dark) 0%, var(--theme-primary) 100%);
        }
    }

    .btn-outline-primary {
        color: var(--theme-accent);
        border-color: var(--theme-accent);

        &:hover,
        &:focus {
            background-color: var(--theme-accent);
            color: var(--theme-surface);
        }
    }

    .form-control,
    .form-select,
    .input-group-text {
        background-color: var(--theme-surface-elevated) !important;
        border-color: var(--theme-border);
        color: var(--theme-text);
    }

    .form-control:focus,
    .form-select:focus {
        background-color: var(--theme-surface-contrast);
        color: var(--theme-text);
        border-color: var(--theme-accent);
        box-shadow: 0 0 0 0.2rem rgba(56, 189, 248, 0.25);
    }

    .dropdown-menu {
        background-color: var(--theme-surface-elevated);
        border: 1px solid var(--theme-border);
        box-shadow: var(--theme-shadow);
        color: var(--theme-text);
    }

    .dropdown-item {
        color: var(--theme-text);

        &:hover,
        &:focus {
            background-color: var(--theme-highlight);
            color: var(--theme-primary);
        }
    }

    .table {
        color: var(--theme-text);

        thead th {
            background-color: var(--theme-surface-contrast);
            border-color: var(--theme-border-strong);
        }

        tbody tr {
            background-color: var(--theme-surface);

            &:nth-child(even) {
                background-color: var(--theme-surface-muted);
            }
        }
    }

    .footer {
        background: linear-gradient(180deg, rgba(12, 18, 34, 0.92) 0%, rgba(13, 23, 45, 0.88) 100%);
        color: var(--theme-text);
        border-top: 1px solid var(--theme-border);
        border-radius: 1.5rem 1.5rem 0 0;

        h5 {
            color: var(--theme-text);
        }

        p {
            color: var(--theme-text-muted);
        }
    }

    .footer-links a {
        color: var(--theme-text) !important;

        &:hover {
            color: var(--theme-primary) !important;
        }
    }

    .footer .social-links {
        gap: 0.75rem;

        a {
            color: var(--theme-accent);
            background: rgba(56, 189, 248, 0.12);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 42px;
            height: 42px;
            border-radius: 50%;
            transition: all 0.3s ease;

            &:hover {
                color: var(--theme-primary);
                background: rgba(56, 189, 248, 0.2);
            }
        }
    }

    .fixed-alert-box .alert {
        background-color: var(--theme-surface-elevated);
        box-shadow: 0 18px 30px rgba(8, 12, 24, 0.55);
        color: var(--theme-text);
    }

    .text-muted {
        color: var(--theme-text-muted) !important;
    }

    @media (max-width: 575.98px) {
        .welcome-card {
            padding: 1rem;
        }
    }

    .navbar .nav-link.active {
        color: var(--theme-text) !important;

        i {
            color: var(--theme-text) !important;
        }
    }

    #questionFormHeading .accordion-button:not(.collapsed) {
        box-shadow: inset 0 calc(-1 * var(--bs-accordion-border-width)) 0 rgba(7, 6, 8, 0.28);
    }

    .conversation-body {
        background: linear-gradient(rgba(118, 75, 162, 0.05), transparent 65%);
    }

    .timeline-content {
        background: var(--theme-surface-muted);
    }

    .package-thumb {
        background-color: rgba(255, 255, 255, 0.95);
    }
}