/* وزن ۴۰۰ - Regular */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* وزن ۵۰۰ - Medium */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

/* وزن ۶۰۰ - SemiBold */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

/* وزن ۷۰۰ - Bold */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Color System - Light Mode */
    --bg: #fafafa;
    --bg-alt: #f5f5f5;
    --surface: #ffffff;
    --surface-elevated: #ffffff;
    --text: #171717;
    --text-secondary: #525252;
    --muted: #737373;
    --primary: #171717;
    --primary-hover: #262626;
    --primary-light: #f5f5f5;
    --accent: #0ea5e9;
    --accent-hover: #0284c7;
    --accent-light: #e0f2fe;
    --border: #e5e5e5;
    --border-hover: #d4d4d4;
    --success: #16a34a;
    --success-light: #dcfce7;
    --error: #dc2626;
    --error-light: #fee2e2;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color-scheme: light;
}

[data-theme="dark"] {
    /* Color System - Dark Mode */
    --bg: #0a0a0a;
    --bg-alt: #141414;
    --surface: #1a1a1a;
    --surface-elevated: #222222;
    --text: #f5f5f5;
    --text-secondary: #a3a3a3;
    --muted: #737373;
    --primary: #f5f5f5;
    --primary-hover: #e5e5e5;
    --primary-light: #262626;
    --accent: #38bdf8;
    --accent-hover: #7dd3fc;
    --accent-light: #0c2333;
    --border: #2a2a2a;
    --border-hover: #3a3a3a;
    --success: #4ade80;
    --success-light: #052e16;
    --error: #f87171;
    --error-light: #2d0909;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Smooth color transitions for all elements during theme switch */
.theme-transitioning,
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
    transition:
        background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        color 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

html {
    direction: rtl;
    scroll-behavior: smooth;
}

body,
.rtl-site {
    font-family: "Vazirmatn", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    direction: rtl;
    text-align: right;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background var(--transition), color var(--transition);
}

a {
    color: var(--text);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent);
}

img {
    max-width: 100%;
    height: auto;
}

/* Container */
.container {
    width: min(1200px, 94%);
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.site-header {
    background: color-mix(in srgb, var(--surface) 95%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background var(--transition), border-color var(--transition);
}

/* Theme Toggle Button */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--bg-alt);
    border-color: var(--border-hover);
    color: var(--text);
    transform: scale(1.05);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    display: none;
}

:root .theme-toggle .icon-moon {
    display: block;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 0;
    gap: 2rem;
}

.brand {
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--text);
    letter-spacing: -0.02em;
}

.brand:hover {
    color: var(--text);
}

.main-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.main-nav a {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.925rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.main-nav a:hover {
    background: var(--primary-light);
    color: var(--text);
}

/* Main Content */
.page-main {
    padding: 3rem 0 4rem;
    min-height: calc(100vh - 180px);
}

/* Hero Section */
.hero {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 4rem 3rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, var(--accent-light) 0%, transparent 50%);
    opacity: 0.3;
    pointer-events: none;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 1rem;
    position: relative;
}

.hero p {
    color: var(--muted);
    max-width: 560px;
    margin: 0 auto 2rem;
    font-size: 1.125rem;
    position: relative;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    position: relative;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    border-radius: var(--radius);
    padding: 0.875rem 1.75rem;
    font: inherit;
    font-weight: 600;
    font-size: 0.925rem;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    color: #fff;
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-alt);
    border-color: var(--border-hover);
    color: var(--text);
}

.btn-accent {
    background: var(--accent);
    color: #fff;
}

.btn-accent:hover {
    background: var(--accent-hover);
    color: #fff;
}

.btn-danger {
    background: var(--error-light);
    color: var(--error);
}

.btn-danger:hover {
    background: #fecaca;
}

/* Shop Home */
.shop-home {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.shop-home h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.shop-home > .text-muted {
    font-size: 1.125rem;
    margin-bottom: 2.5rem;
}

/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    background: var(--bg-alt);
}

.card-body {
    padding: 1.5rem;
}

.card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
}

.card p {
    color: var(--muted);
    font-size: 0.925rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

/* Price Tags */
.price-tag {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--accent);
    margin: 0.75rem 0 1rem;
    display: inline-block;
}

.price-tag-lg {
    font-size: 1.5rem;
}

.price-wrap {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem 0.75rem;
}

.price-wrap-lg {
    gap: 0.5rem 1rem;
}

.price-original {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: line-through;
}

.price-wrap-lg .price-original {
    font-size: 1.1rem;
}

.price-sale {
    margin: 0;
}

.links-bulk-box {
    margin-bottom: 1.25rem;
    padding: 1rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: var(--bg-alt);
}

.links-bulk-box textarea {
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--bg-alt);
    color: var(--text-secondary);
}

.badge-owned {
    background: var(--success-light);
    color: var(--success);
    margin-bottom: 0.75rem;
}

.badge-admin {
    background: var(--accent-light);
    color: var(--accent);
}

/* Panels */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.panel h1,
.panel h2 {
    margin-top: 0;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.panel h1 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
}

.panel h2 {
    font-size: 1.35rem;
    margin-bottom: 1.25rem;
    margin-top: 2rem;
}

/* Forms */
.form-grid {
    display: grid;
    gap: 1.25rem;
}

label {
    display: grid;
    gap: 0.5rem;
    font-weight: 500;
    font-size: 0.925rem;
    color: var(--text-secondary);
}

input[type="text"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="email"],
textarea,
select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    font: inherit;
    font-size: 1rem;
    background: var(--surface);
    color: var(--text);
    transition: all var(--transition);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

input::placeholder,
textarea::placeholder {
    color: var(--muted);
}

textarea {
    min-height: 140px;
    resize: vertical;
}

.password-row {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.password-row input {
    flex: 1;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: var(--error-light);
    color: var(--error);
    border: 1px solid #fecaca;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: right;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg-alt);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: var(--bg);
}

/* Course Detail */
.course-detail {
    display: grid;
    gap: 2rem;
}

.course-detail img {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.course-hero-image {
    width: 100%;
    max-height: 480px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

/* Shop Product */
.shop-product {
    max-width: 800px;
}

.shop-product > a:first-child {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.925rem;
    margin-bottom: 1.5rem;
    transition: color var(--transition);
}

.shop-product > a:first-child:hover {
    color: var(--text);
}

.shop-product h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.shop-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

/* Download List */
.download-list {
    list-style: none;
    display: grid;
    gap: 0.75rem;
}

.download-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    transition: all var(--transition);
}

.download-list a:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

/* Gallery */
.course-gallery h2 {
    margin-top: 2.5rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.gallery-item {
    display: block;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: all var(--transition);
}

.gallery-item img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.gallery-item:hover {
    border-color: var(--accent);
    transform: scale(1.02);
}

/* Admin */
.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.link-row {
    display: grid;
    grid-template-columns: 1fr 2fr auto;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    align-items: center;
}

.image-preview-main {
    max-width: 300px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: block;
}

.gallery-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.gallery-admin-item {
    display: grid;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.gallery-admin-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

/* Contact Page */
.contact-page h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.contact-page h2 {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.social-list,
.contact-extra {
    list-style: none;
    display: grid;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.social-list a {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    transition: all var(--transition);
}

.social-list a:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    transform: translateY(-2px);
}

.social-title {
    font-weight: 600;
    color: var(--text);
    font-size: 1rem;
}

.social-url {
    font-size: 0.875rem;
    color: var(--muted);
    word-break: break-all;
}

.contact-extra li {
    padding: 0.5rem 0;
    font-size: 1rem;
}

.contact-extra a {
    color: var(--accent);
}

.contact-extra a:hover {
    text-decoration: underline;
}

/* FAQ & Support */
.support-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.faq-list {
    display: grid;
    gap: 0.75rem;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}

.faq-item summary {
    padding: 1rem 1.25rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item[open] summary {
    border-bottom: 1px solid var(--border);
    background: var(--bg-alt);
}

.faq-answer {
    padding: 1rem 1.25rem 1.25rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.badge-ticket-open {
    background: var(--accent-light);
    color: var(--accent);
}

.badge-ticket-answered {
    background: var(--success-light);
    color: var(--success);
}

.badge-ticket-closed {
    background: var(--bg-alt);
    color: var(--muted);
}

.ticket-thread {
    display: grid;
    gap: 1rem;
}

.ticket-message {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    background: var(--surface);
}

.ticket-message-user {
    border-right: 3px solid var(--border);
}

.ticket-message-staff {
    border-right: 3px solid var(--accent);
    background: var(--accent-light);
}

.ticket-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.ticket-message-header time {
    color: var(--muted);
}

.ticket-message-body {
    color: var(--text-secondary);
    line-height: 1.8;
}

.ticket-filters .btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    background: var(--surface);
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.footer-inner p {
    color: var(--muted);
    font-size: 0.925rem;
}

.footer-nav {
    display: flex;
    gap: 1.5rem;
}

.footer-nav a {
    color: var(--muted);
    font-size: 0.925rem;
}

.footer-nav a:hover {
    color: var(--text);
}

/* Utility Classes */
.text-muted {
    color: var(--muted);
}

.text-center {
    text-align: center;
}

input,
textarea,
select,
label,
th,
td {
    text-align: right;
}

/* Responsive */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 0;
    }

    .main-nav {
        width: 100%;
        justify-content: center;
    }

    .hero {
        padding: 2.5rem 1.5rem;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 1.5rem;
    }

    .link-row {
        grid-template-columns: 1fr;
    }

    .shop-product h1 {
        font-size: 1.5rem;
    }

    .price-tag-lg {
        font-size: 1.25rem;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }
}

/* Animation for cards on load */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.5s ease forwards;
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.4s; }
.card:nth-child(5) { animation-delay: 0.5s; }
.card:nth-child(6) { animation-delay: 0.6s; }

/* Focus states for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Selection */
::selection {
    background: var(--accent-light);
    color: var(--text);
}
