/* ============ متغیرها ============ */
:root {
    --bg: #f5f7fa;
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --bg-footer: #1a1a2e;
    --text: #333333;
    --text-light: #777777;
    --text-heading: #222222;
    --border: #e0e0e0;
    --shadow: rgba(0, 0, 0, 0.07);
    --shadow-hover: rgba(108, 92, 231, 0.25);
    --primary: #6c5ce7;
    --primary-hover: #5546c9;
    --danger: #e74c3c;
    --danger-hover: #c0392b;
    --success: #27ae60;
    --footer-text: #bbbbbb;
}

[data-theme="dark"] {
    --bg: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-header: #15152a;
    --bg-footer: #0a0a14;
    --text: #e0e0e0;
    --text-light: #999999;
    --text-heading: #ffffff;
    --border: #2a2a40;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(108, 92, 231, 0.4);
    --footer-text: #888888;
}

/* ============ ریست ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html { scroll-behavior: smooth; }

html, body {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    font-family: Tahoma, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

input, textarea, select {
    font-size: 16px !important;
}

/* ============ کانتینر ============ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============ دکمه‌ها ============ */
.btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 10px 25px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
    transition: background 0.3s, transform 0.2s;
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); }

.btn-small { padding: 6px 14px; font-size: 13px; border-radius: 6px; }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover { background: var(--primary); color: #fff; }

.btn-large {
    padding: 14px 32px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 12px;
}

.btn-full { width: 100%; padding: 14px; font-size: 16px; }

.btn-ghost {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    backdrop-filter: blur(6px);
}

.btn-ghost:hover { background: rgba(255, 255, 255, 0.3); color: #fff; }

/* ============ هدر ============ */
.header {
    background: var(--bg-header);
    box-shadow: 0 2px 10px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background 0.3s;
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

/* لوگو */
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 24px;
    font-weight: bold;
    color: var(--primary);
    transition: transform 0.3s;
}

.logo:hover { transform: scale(1.05); }

.logo-icon {
    display: inline-block;
    animation: pulse-glow 2.5s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 transparent); }
    50% { transform: scale(1.15); filter: drop-shadow(0 0 8px var(--primary)); }
}

.logo-text {
    background: linear-gradient(135deg, var(--primary), #00c6ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.navbar ul { display: flex; gap: 30px; }

.navbar a {
    color: var(--text);
    font-size: 15px;
    transition: color 0.3s;
    position: relative;
}

.navbar a:hover { color: var(--primary); }

.navbar a.active { color: var(--primary); font-weight: bold; }

.navbar a.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 0;
    left: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

/* دکمه‌های هدر */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle {
    background: var(--bg);
    border: 2px solid var(--border);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, border 0.3s, transform 0.2s;
}

.theme-toggle:hover { transform: scale(1.1); border-color: var(--primary); }

/* منوی همبرگری */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: 2px solid var(--border);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: border-color 0.3s;
}

.menu-toggle:hover { border-color: var(--primary); }

.menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}

.menu-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   ============ هیرو ============
   ============================================================ */
.hero {
    position: relative;
    padding: 100px 0 110px;
    text-align: center;
    color: #fff;
    background: linear-gradient(135deg, #6c5ce7 0%, #00c6ff 100%);
    overflow: hidden;
}

.hero-bg-shapes {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
}

.shape-1 { width: 220px; height: 220px; top: -70px; right: -50px; }
.shape-2 { width: 320px; height: 320px; bottom: -120px; left: -90px; }
.shape-3 {
    width: 150px; height: 150px;
    top: 40%; left: 15%;
    background: rgba(255, 255, 255, 0.08);
}

.hero-content { position: relative; z-index: 2; }

.hero-badge {
    display: inline-block;
    padding: 6px 18px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    font-size: 14px;
    margin-bottom: 20px;
    backdrop-filter: blur(6px);
}

.hero-title {
    font-size: 52px;
    line-height: 1.2;
    margin-bottom: 18px;
}

.gradient-text {
    background: linear-gradient(135deg, #fff, #ffe0ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

.hero-subtitle {
    font-size: 19px;
    opacity: 0.95;
    margin-bottom: 35px;
}

.hero-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================================
   ============ آمار ============
   ============================================================ */
.stats { padding: 60px 0 20px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.stat-card {
    background: var(--bg-card);
    padding: 25px 20px;
    border-radius: 14px;
    text-align: center;
    box-shadow: 0 4px 15px var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--shadow-hover);
}

.stat-number {
    font-size: 34px;
    font-weight: bold;
    background: linear-gradient(135deg, var(--primary), #00c6ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
}

.stat-label { font-size: 14px; color: var(--text-light); }

/* ============================================================
   ============ بخش ابزارها ============
   ============================================================ */
.tools { padding: 70px 0; }

.section-header {
    text-align: center;
    margin-bottom: 35px;
}

.section-header h2 {
    font-size: 34px;
    margin-bottom: 10px;
    color: var(--text-heading);
    transition: color 0.3s;
}

.subtitle {
    text-align: center;
    color: var(--text-light);
}

.search-box {
    position: relative;
    max-width: 520px;
    margin: 0 auto 45px;
}

.search-icon {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    pointer-events: none;
    z-index: 2;
    transition: transform 0.3s;
}

.search-box input {
    width: 100%;
    padding: 14px 50px 14px 20px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-family: inherit;
    font-size: 16px;
    outline: none;
    background: var(--bg-card);
    color: var(--text);
    transition: border 0.3s, box-shadow 0.3s, background 0.3s, color 0.3s;
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.15);
}

/* شبکه ابزارها */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
}

.tool-card {
    background: var(--bg-card);
    padding: 28px 22px;
    border-radius: 14px;
    box-shadow: 0 4px 15px var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 130px;
    border-right: 5px solid var(--primary);
}

.tool-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 25px var(--shadow-hover);
}

.tool-card h3 {
    color: var(--text-heading);
    font-size: 19px;
    margin-bottom: 15px;
    line-height: 1.5;
    transition: color 0.3s;
}

.tool-link {
    color: var(--primary);
    font-size: 14px;
    font-weight: bold;
    margin-top: auto;
}

/* کارت‌های جدید */
.tool-card-new {
    position: relative;
    text-align: center;
    padding: 32px 20px;
    border-right: none !important;
    border-top: 4px solid var(--primary);
    overflow: hidden;
    min-height: auto;
}

.tool-card-new::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(108, 92, 231, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.tool-card-new:hover::before { opacity: 1; }

.tool-icon {
    font-size: 44px;
    margin-bottom: 15px;
    transition: transform 0.4s;
}

.tool-card-new:hover .tool-icon { transform: scale(1.15) rotate(-5deg); }

.tool-card-new h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-heading);
}

.tool-desc {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 15px;
    direction: ltr;
    font-family: 'Courier New', monospace;
}

.color-purple { border-top-color: #6c5ce7; }
.color-blue   { border-top-color: #0984e3; }
.color-green  { border-top-color: #00b894; }
.color-orange { border-top-color: #e17055; }
.color-pink   { border-top-color: #e84393; }
.color-teal   { border-top-color: #00cec9; }

/* وضعیت‌ها */
.loading, .error {
    text-align: center;
    color: var(--text-light);
    grid-column: 1 / -1;
    padding: 30px;
    font-size: 15px;
}

.error { color: var(--danger); }
.success { color: var(--success); }

/* ============================================================
   ============ تبلیغات (اصلاح‌شده) ============
   ============================================================ */
.ad-slot {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px var(--shadow);
    background: var(--bg-card);
}

.ad-top, .ad-bottom {
    max-width: 1200px;
    margin: 15px auto;
}

.ad-bottom { margin-bottom: 40px; }

.ad-image {
    width: 100%;
    display: block;
    object-fit: cover;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), #00c6ff);
}

.ad-top .ad-image,
.ad-bottom .ad-image {
    max-height: 160px;
    object-fit: cover;
}

.ad-side .ad-image {
    max-height: 260px;
    object-fit: cover;
    border-radius: 10px;
}

.ad-layout {
    display: grid;
    grid-template-columns: 180px 1fr 180px;
    gap: 20px;
    align-items: start;
}

.ad-layout.no-side-ads {
    grid-template-columns: 1fr;
}

.ad-layout-main { min-width: 0; }

.ad-side {
    position: sticky;
    top: 90px;
    max-width: none;
    margin: 0;
    min-height: 280px;
}

.ad-slider {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    min-height: 80px;
}

.ad-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    pointer-events: none;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.ad-slide.active {
    opacity: 1;
    position: relative;
    pointer-events: auto;
}

.ad-slide.no-image {
    background: linear-gradient(135deg, var(--primary), #00c6ff);
    min-height: 80px;
}

.ad-caption {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    padding: 10px 14px;
    background: linear-gradient(to top, rgba(0,0,0,0.75), transparent);
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    text-align: right;
    text-decoration: none;
}

.ad-caption:hover { text-decoration: underline; }

.ad-label {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: bold;
    z-index: 5;
    backdrop-filter: blur(4px);
}

.ad-dots {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 5;
}

.ad-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    border: none;
    padding: 0;
}

.ad-dot:hover { transform: scale(1.2); }
.ad-dot.active { background: #fff; }

/* ============ موبایل: تبلیغات کناری زیر محتوا ============ */
@media (max-width: 992px) {
    .ad-layout {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .ad-layout-main {
        order: 1;
        width: 100%;
    }

    .ad-side {
        position: static !important;
        display: block !important;
        width: 100%;
        min-height: auto;
        margin: 0;
        border-radius: 10px;
    }

    .ad-side.ad-right { order: 2; }
    .ad-side.ad-left  { order: 3; }

    .ad-side .ad-image {
        max-height: 140px;
        width: 100%;
        object-fit: cover;
        border-radius: 10px;
    }

    .ad-side .ad-slider { min-height: 60px; }
}

@media (max-width: 600px) {
    .ad-top .ad-image,
    .ad-bottom .ad-image { max-height: 100px; }

    .ad-side .ad-image { max-height: 120px; }

    .ad-caption { font-size: 12px; padding: 8px 10px; }
    .ad-label { font-size: 9px; padding: 2px 6px; }
}

/* ============================================================
   ============ فوتر ============
   ============================================================ */
.footer {
    margin-top: 80px;
    padding: 50px 0 0;
    background: var(--bg-footer);
    color: var(--footer-text);
    font-size: 14px;
    transition: background 0.3s, color 0.3s;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 30px;
    padding-bottom: 35px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-logo {
    margin-bottom: 15px;
    font-size: 22px;
}

.footer-desc {
    font-size: 14px;
    line-height: 1.8;
    color: var(--footer-text);
}

.footer-col h4 {
    font-size: 16px;
    color: #fff;
    margin-bottom: 15px;
}

.footer-col ul {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-col ul a {
    font-size: 14px;
    color: var(--footer-text);
    transition: color 0.3s;
}

.footer-col ul a:hover { color: var(--primary); }

.footer-bottom {
    text-align: center;
    padding: 22px 0;
    font-size: 13px;
    color: var(--footer-text);
}

.footer p { margin: 5px 0; }

/* دکمه برو بالا */
.scroll-top {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--shadow-hover);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s, background 0.3s;
    z-index: 200;
}

.scroll-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top:hover {
    background: var(--primary-hover);
    transform: translateY(-3px) scale(1.05);
}

/* ============================================================
   ============ صفحات ابزار ============
   ============================================================ */
.tool-page {
    padding: 70px 0;
    min-height: calc(100vh - 240px);
}

.tool-page h1 {
    text-align: center;
    font-size: 32px;
    margin-bottom: 10px;
    color: var(--text-heading);
    transition: color 0.3s;
}

.tool-page .subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 40px;
}

.tool-form,
.calculator-box,
.converter-box,
.password-box {
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-card);
    padding: 30px;
    border-radius: 14px;
    box-shadow: 0 4px 20px var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: background 0.3s;
}

.tool-form input,
.calculator-box input,
.converter-box input,
.password-box input,
.converter-box select {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 16px;
    outline: none;
    background: var(--bg-card);
    color: var(--text);
    transition: border 0.3s, background 0.3s, color 0.3s;
}

.tool-form input:focus,
.calculator-box input:focus,
.converter-box input:focus,
.password-box input:focus,
.converter-box select:focus {
    border-color: var(--primary);
}

.converter-box label {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: -8px;
}

.hint {
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
    margin-top: 20px;
}

.result {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: var(--primary);
    margin-top: 10px;
}

/* ============================================================
   ============ صفحات مدیریت ============
   ============================================================ */
.admin-page {
    padding: 60px 0;
    min-height: calc(100vh - 200px);
}

.admin-page h1 {
    text-align: center;
    font-size: 30px;
    margin-bottom: 10px;
    color: var(--text-heading);
}

.admin-page .subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 35px;
}

.admin-box {
    max-width: 450px;
    margin: 0 auto;
    background: var(--bg-card);
    padding: 30px;
    border-radius: 14px;
    box-shadow: 0 4px 20px var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-box label {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: -4px;
}

.admin-box input,
.admin-box select,
.admin-box textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 16px;
    background: var(--bg-card);
    color: var(--text);
    outline: none;
    transition: border 0.3s;
}

.admin-box input:focus,
.admin-box select:focus,
.admin-box textarea:focus {
    border-color: var(--primary);
}

/* پنل مدیریت */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.panel-header h1 { text-align: right; margin: 0; }

.panel-section {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 14px;
    box-shadow: 0 4px 20px var(--shadow);
    margin-bottom: 25px;
}

.panel-section h2 {
    font-size: 20px;
    margin-bottom: 15px;
    color: var(--text-heading);
}

.panel-section label {
    display: block;
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 6px;
    margin-top: 10px;
}

.panel-section input[type="text"],
.panel-section input[type="file"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 16px;
    background: var(--bg-card);
    color: var(--text);
    outline: none;
    margin-bottom: 12px;
    transition: border 0.3s;
}

.panel-section input[type="text"]:focus {
    border-color: var(--primary);
}

.hint-small {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 12px;
}

.tools-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tool-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: var(--bg);
    border-radius: 10px;
    border-right: 4px solid var(--primary);
    gap: 15px;
    flex-wrap: wrap;
}

.tool-item .tool-name {
    font-weight: bold;
    color: var(--text-heading);
}

.tool-item .tool-file {
    font-size: 13px;
    color: var(--text-light);
    font-family: 'Courier New', monospace;
    direction: ltr;
    text-align: right;
}

.tool-item .tool-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ============================================================
   ============ لیست کشویی سفارشی ============
   ============================================================ */
.custom-select {
    position: relative;
    margin-bottom: 12px;
    user-select: none;
}

.custom-select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    cursor: pointer;
    transition: border 0.3s, box-shadow 0.3s;
}

.custom-select-trigger:hover { border-color: var(--primary); }

.custom-select.open .custom-select-trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.custom-select-trigger .arrow {
    font-size: 11px;
    color: var(--text-light);
    transition: transform 0.3s;
}

.custom-select.open .custom-select-trigger .arrow { transform: rotate(180deg); }

.custom-select-options {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 25px var(--shadow);
    z-index: 50;
    max-height: 280px;
    overflow-y: auto;
    display: none;
}

.custom-select.open .custom-select-options {
    display: block;
    animation: dropdownFade 0.2s ease-out;
}

@keyframes dropdownFade {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.custom-option {
    padding: 12px 15px;
    cursor: pointer;
    color: var(--text);
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
    border-bottom: 1px solid var(--border);
}

.custom-option:last-child { border-bottom: none; }
.custom-option:hover { background: var(--primary); color: #fff; }

.custom-option.disabled {
    color: var(--text-light);
    cursor: default;
    text-align: center;
}

.custom-option.disabled:hover {
    background: transparent;
    color: var(--text-light);
}

.custom-select-options::-webkit-scrollbar { width: 6px; }
.custom-select-options::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* ============================================================
   ============ ادیتور کد ============
   ============================================================ */
.editor-status {
    padding: 10px 15px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-light);
    border-right: 4px solid var(--primary);
}

.editor-wrapper {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    background: var(--bg-card);
    direction: ltr;
    transition: border 0.3s, box-shadow 0.3s;
}

.editor-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.line-numbers {
    padding: 15px 10px;
    background: var(--bg);
    color: var(--text-light);
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    text-align: right;
    user-select: none;
    overflow: hidden;
    min-width: 50px;
    border-right: 1px solid var(--border);
    white-space: pre;
}

#code-editor {
    flex: 1;
    width: 100%;
    min-height: 350px;
    max-height: 600px;
    padding: 15px;
    border: none;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    background: var(--bg-card);
    color: var(--text);
    outline: none;
    resize: vertical;
    direction: ltr;
    text-align: left;
    white-space: pre;
    overflow: auto;
    tab-size: 4;
}

.editor-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

/* ============================================================
   ============ پنل ادمین تبلیغات ============
   ============================================================ */
.ad-admin-grid {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 15px;
}

.ad-admin-card {
    background: var(--bg);
    padding: 18px;
    border-radius: 12px;
    border-right: 4px solid var(--primary);
}

.ad-admin-card h3 {
    font-size: 15px;
    margin-bottom: 12px;
    color: var(--text-heading);
}

.ad-admin-card label {
    display: block;
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 5px;
    margin-top: 8px;
}

.ad-admin-card input[type="text"],
.ad-admin-card input[type="url"] {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    background: var(--bg-card);
    color: var(--text);
    outline: none;
    transition: border 0.3s;
}

.ad-admin-card input[type="text"]:focus,
.ad-admin-card input[type="url"]:focus {
    border-color: var(--primary);
}

.ad-admin-card input[type="file"] {
    width: 100%;
    padding: 8px;
    border: 1px dashed var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
}

.ad-img-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 10px;
}

.ad-img-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
}

.ad-img-box h4 {
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--primary);
}

.ad-img-preview {
    width: 100%;
    height: 80px;
    background: var(--bg);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--text-light);
    margin-top: 8px;
    overflow: hidden;
}

.ad-img-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ad-toggle {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin-top: 12px !important;
    cursor: pointer;
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text);
}

.ad-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* ============================================================
   ============ ریسپانسیو ============
   ============================================================ */
@media (max-width: 992px) {
    .tools-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    /* هدر */
    .header .container {
        height: 60px;
        padding: 0 15px;
    }

    .menu-toggle { display: flex; }

    .navbar {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        background: var(--bg-header);
        box-shadow: 0 8px 20px var(--shadow);
        border-top: 1px solid var(--border);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.35s ease-out;
        z-index: 99;
    }

    .navbar.open { max-height: 300px; }

    .navbar ul {
        flex-direction: column;
        gap: 0;
        padding: 10px 20px 15px;
    }

    .navbar ul li { border-bottom: 1px solid var(--border); }
    .navbar ul li:last-child { border-bottom: none; }

    .navbar a {
        display: block;
        padding: 12px 5px;
        font-size: 15px;
    }

    .navbar a.active::after { display: none; }

    /* هیرو */
    .hero { padding: 55px 0 65px; }
    .hero-title { font-size: 30px; line-height: 1.25; }
    .hero-subtitle { font-size: 15px; margin-bottom: 25px; }
    .hero-badge { font-size: 12px; padding: 5px 14px; }
    .btn-large { padding: 12px 28px; font-size: 15px; }

    /* آمار */
    .stats { padding: 40px 0 10px; }
    .stat-card { padding: 18px 12px; }
    .stat-number { font-size: 26px; }
    .stat-label { font-size: 12px; }

    /* ابزارها */
    .tools { padding: 45px 0; }
    .section-header h2 { font-size: 24px; }
    .section-header .subtitle { font-size: 14px; }

    .search-box { margin-bottom: 30px; }
    .search-box input { padding: 13px 45px 13px 15px; }
    .search-icon { right: 15px; font-size: 16px; }

    .tools-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .tool-card-new { padding: 22px 12px; }
    .tool-icon { font-size: 36px; margin-bottom: 10px; }
    .tool-card-new h3 { font-size: 15px; margin-bottom: 6px; }
    .tool-desc { font-size: 10px; margin-bottom: 10px; }
    .tool-link { font-size: 12px; }

    /* فوتر */
    .footer { margin-top: 50px; padding: 35px 0 0; }
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 25px;
        padding-bottom: 25px;
        text-align: center;
    }
    .footer-logo { justify-content: center; }
    .footer-col ul { align-items: center; }
    .footer-col h4 { font-size: 15px; }
    .footer-bottom { font-size: 12px; padding: 18px 0; }

    /* دکمه بالا */
    .scroll-top {
        bottom: 18px;
        left: 18px;
        width: 44px;
        height: 44px;
        font-size: 20px;
    }

    /* پنل ادمین */
    .panel-header { flex-direction: column; text-align: center; }
    .panel-header h1 { text-align: center; }
    .editor-actions { flex-direction: column; }
    .editor-actions .btn { width: 100%; }
    #code-editor { min-height: 250px; }
    .ad-img-row { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
    .hero-title { font-size: 24px; }
    .hero-subtitle { font-size: 13px; }
    .tools-grid { grid-template-columns: 1fr; }
    .stat-number { font-size: 22px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .tools-grid { grid-template-columns: repeat(3, 1fr); }
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ============ ناچ آیفون ============ */
@supports (padding: max(0px)) {
    .header .container {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }

    .scroll-top {
        bottom: max(18px, env(safe-area-inset-bottom));
        left: max(18px, env(safe-area-inset-left));
    }

    .footer-bottom {
        padding-bottom: max(22px, env(safe-area-inset-bottom));
    }
}