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

:root {
    --bg: #020617;
    --bg-soft: #0b1120;
    --card: #020617;
    --accent: #22d3ee;
    --accent-soft: rgba(56,189,248,0.18);
    --text: #e5e7eb;
    --muted: #9ca3af;
    --border: #1e293b;
    --radius: 14px;
    --shadow-soft: 0 22px 60px rgba(15,23,42,0.9);
    --danger: #f97373;
    --success: #4ade80;
}

html, body {
    margin: 0;
    padding: 0;
    background: radial-gradient(circle at top left, #1e293b 0, #020617 45%, #000 100%);
    color: var(--text);
    font-family: "Cairo", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.rtl {
    direction: rtl;
}
body.ltr {
    direction: ltr;
}

.container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Header */

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(15,23,42,0.98);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(148,163,184,0.45);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 62px;
    gap: 8px;
}

.logo a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}
.logo-icon {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: linear-gradient(to bottom right, #22d3ee, #22c55e);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #020617;
    font-weight: 700;
    font-size: 16px;
}
.logo-text {
    font-size: 14px;
    color: #f9fafb;
    font-weight: 600;
}

.main-nav {
    display: flex;
    gap: 6px;
    align-items: center;
}

.nav-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.6);
    font-size: 11px;
    color: var(--muted);
    text-decoration: none;
    background: rgba(15,23,42,0.9);
    transition: all 0.16s ease;
}
.nav-pill:hover {
    border-color: var(--accent);
    color: #e0f2fe;
}
.nav-pill.active {
    border-color: rgba(56,189,248,0.9);
    color: #020617;
    background: linear-gradient(to right, #06b6d4, #22c55e);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-switch {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.6);
    background: rgba(15,23,42,0.95);
}
.lang-switch a {
    text-decoration: none;
    color: var(--muted);
}
.lang-switch a.active {
    color: #f9fafb;
    font-weight: 600;
}
.lang-switch span {
    margin: 0 4px;
    color: rgba(148,163,184,0.7);
}

.admin-link {
    font-size: 11px;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.5);
    color: var(--muted);
    background: rgba(15,23,42,0.9);
}
.admin-link:hover {
    border-color: var(--accent);
    color: #e0f2fe;
}

.nav-toggle {
    display: none;
    border: none;
    background: none;
    color: var(--text);
    font-size: 22px;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 16px;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.16s ease;
}
.btn.primary {
    background: linear-gradient(to right, #06b6d4, #22c55e);
    border-color: rgba(56,189,248,0.8);
    color: #f9fafb;
}
.btn.primary:hover {
    filter: brightness(1.06);
}

/* Hero */

.main-content {
    padding-bottom: 40px;
}

.hero {
    padding: 26px 0 22px;
    background: radial-gradient(circle at top left, rgba(56,189,248,0.18), transparent 55%);
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
}


.hero-text h1 {
    font-size: 26px;
    margin: 0 0 8px;
}
.hero-text p {
    font-size: 14px;
    color: var(--muted);
    max-width: 520px;
    line-height: 1.7;
}
.hero-badge {
    margin-top: 16px;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}
.hero-badge span {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.7);
    background: rgba(15,23,42,0.98);
    color: var(--muted);
}

/* Converter card */
.converter-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}
.converter-asset-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.asset-pill {
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.7);
    background: rgba(15,23,42,0.95);
    padding: 3px 10px;
    font-size: 11px;
    color: #9ca3af;
    cursor: pointer;
}
.asset-pill.active {
    border-color: rgba(56,189,248,0.9);
    color: #e0f2fe;
    background: radial-gradient(circle at top left,#0ea5e9,#22c55e);
}
.converter-form .converter-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}
.swap-btn {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.7);
    background: rgba(15,23,42,0.95);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    margin-top: 20px;
}
.swap-btn:hover {
    border-color: rgba(56,189,248,0.9);
}
.select-search-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.select-search-input {
    background: rgba(15,23,42,0.98);
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.7);
    padding: 4px 8px;
    font-size: 11px;
    color: #e5e7eb;
}
.select-search-input:focus {
    outline: none;
    border-color: #22d3ee;
    box-shadow: 0 0 0 1px rgba(56,189,248,0.5);
}
.label-text {
    font-size: 11px;
    color: #9ca3af;
}
.converter-meta {
    margin-top: 6px;
    font-size: 11px;
    color: #9ca3af;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.hero-card {
        width: 100%;

    padding: 18px 18px 16px;
    border-radius: 18px;
    background: radial-gradient(circle at top left, #0f172a 0, #020617 60%);
    border: 1px solid rgba(148,163,184,0.6);
    box-shadow: var(--shadow-soft);
}
.hero-card h2 {
    margin: 0 0 12px;
    font-size: 15px;
}

.converter-form {
    font-size: 12px;
}
.converter-form label {
    display: block;
    margin-bottom: 10px;
}
.converter-form .row {
    display: flex;
    gap: 8px;
}
.converter-form input,
.converter-form select {
    background: rgba(15,23,42,0.98);
    border-radius: 10px;
    border: 1px solid rgba(148,163,184,0.7);
    padding: 6px 9px;
    font-size: 12px;
    color: var(--text);
    flex: 1;
}
.converter-form input:focus,
.converter-form select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(56,189,248,0.5);
}

.converter-result {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(30,64,175,0.7);
    font-size: 12px;
}
.converter-result .result-text {
    margin-top: 4px;
}
.converter-result .error {
    color: var(--danger);
}
.converter-result small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

/* Sections */

.section-block {
    padding: 18px 0 8px;
}
.section-title {
    font-size: 16px;
    margin: 0 0 6px;
}
.section-sub {
    font-size: 12px;
    color: var(--muted);
    margin: 0 0 10px;
}

.two-cols {
    display: grid;
    grid-template-columns: minmax(0,1.2fr) minmax(0,1fr);
    gap: 20px;
}

/* Tables */

.table-wrapper {
    margin-top: 6px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(30,64,175,0.8);
    background: rgba(15,23,42,0.98);
    box-shadow: 0 18px 42px rgba(15,23,42,1);
}
.table-wrapper.narrow {
    max-width: 420px;
}
/* ============ ADS ============ */

.ad-banner {
    background: radial-gradient(circle at top left, #020617, #020617);
    padding: 6px 0;
    margin: 0 0 6px;
    border-bottom: 1px solid rgba(30,64,175,0.4);
}

.ad-bottom {
    margin-top: 12px;
    border-top: 1px solid rgba(30,64,175,0.4);
    border-bottom: none;
}

/* شريط التمرير */
.ad-marquee {
    overflow: hidden;
    position: relative;
}

.ad-track {
    display: inline-flex;
    align-items: center;
    gap: 18px;
    white-space: nowrap;
    animation: ad-scroll-left 30s linear infinite;
    will-change: transform;
}

/* إيقاف الحركة عند الـ hover */
.ad-banner:hover .ad-track {
    animation-play-state: paused;
}

/* كل إعلان منفصل */
.ad-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 14px;
    border-radius: 999px;
    background: rgba(15,23,42,0.98);
    border: 1px solid rgba(148,163,184,0.6);
    min-height: 42px;
    min-width: 160px;
    max-width: 230px;      /* يمنع الصورة تكبر قوي */
    overflow: hidden;      /* قص الزيادة */
    text-decoration: none;
    transition: transform 0.12s ease,
                box-shadow 0.12s ease,
                border-color 0.12s ease;
}

.ad-item:hover {
    border-color: rgba(56,189,248,0.9);
    box-shadow: 0 6px 18px rgba(15,23,42,0.8);
    transform: translateY(-1px);
}

/* صورة الإعلان */
.ad-item img,
.ad-img {
    max-height: 40px;          /* أقصى ارتفاع للصورة */
    width: auto !important;    /* ما تتمدش على 100% */
    max-width: 100%;           /* ما تطلعش برا الإعلان */
    object-fit: contain;       /* يحافظ على النسبة */
    display: block;
}

/* إعلان نصي بدون صورة */
.ad-text {
    font-size: 12px;
    color: #e5e7eb;
    white-space: nowrap;
}

/* أنيميشن التمرير من اليمين لليسار */
@keyframes ad-scroll-left {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* موبايل */
@media (max-width: 768px) {
    .ad-banner {
        padding: 4px 0;
    }
    .ad-item {
        min-width: 140px;
        max-width: 190px;
        padding: 3px 10px;
    }
    .ad-item img,
    .ad-img {
        max-height: 30px;
    }
}
.rates-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.rates-table thead {
    background: linear-gradient(to right, rgba(30,64,175,0.98), rgba(56,189,248,0.3));
}
.rates-table th,
.rates-table td {
    padding: 9px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(15,23,42,0.98);
}
.rates-table tbody tr:nth-child(even) {
    background: rgba(15,23,42,0.98);
}
.rates-table tbody tr:nth-child(odd) {
    background: rgba(15,23,42,0.96);
}
.rates-table td.pos {
    color: var(--success);
}
.rates-table td.neg {
    color: var(--danger);
}

/* Ads */

.ad-banner {
    padding: 6px 0;
}
.ad-inner {
    display: flex;
    justify-content: center;
    border-radius: 16px;
    border: 1px dashed rgba(148,163,184,0.6);
    padding: 6px;
    background: rgba(15,23,42,0.95);
}
.ad-inner img {
    max-width: 100%;
    max-height: 90px;
    border-radius: 12px;
    display: block;
}

/* News */

.news-grid {
    margin-top: 8px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px,1fr));
    gap: 12px;
}
.news-card {
    border-radius: 16px;
    background: rgba(15,23,42,0.98);
    border: 1px solid rgba(30,64,175,0.7);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 18px 42px rgba(15,23,42,0.9);
}
.news-card .thumb {
    width: 100%;
    max-height: 160px;
    overflow: hidden;
}
.news-card .thumb img {
    width: 100%;
    display: block;
    object-fit: cover;
}
.news-card .body {
    padding: 10px 12px 10px;
    font-size: 12px;
}
.news-card .body h3 {
    margin: 0 0 6px;
    font-size: 13px;
}
.news-card .body p {
    margin: 0 0 8px;
    color: var(--muted);
}
.news-card .meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--muted);
}
.news-card .meta a {
    color: var(--accent);
    text-decoration: none;
}
.news-card .meta a:hover {
    text-decoration: underline;
}

.article-container {
    max-width: 760px;
}
.single-article h1 {
    margin: 0 0 6px;
    font-size: 20px;
}
.single-article .meta {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 8px;
}
.single-article .thumb.large {
    margin: 8px 0 10px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(30,64,175,0.7);
}
.single-article .thumb.large img {
    width: 100%;
    display: block;
}
.single-article .content {
    font-size: 13px;
    line-height: 1.8;
    color: #e5e7eb;
}
.muted {
    font-size: 12px;
    color: var(--muted);
}

/* Hints */

.hint {
    font-size: 11px;
    color: var(--muted);
    margin-top: 10px;
}

/* Footer */

.site-footer {
    margin-top: 28px;
    border-top: 1px solid rgba(30,64,175,0.7);
    background: rgba(15,23,42,0.98);
}
.footer-inner {
    padding: 14px 0 18px;
    text-align: center;
    font-size: 11px;
    color: var(--muted);
}
.footer-inner p {
    margin: 0 0 4px;
}

/* Admin auth */

.admin-auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.admin-auth-card {
    width: 100%;
    max-width: 360px;
    padding: 20px 18px 18px;
    border-radius: 18px;
    background: rgba(15,23,42,0.98);
    border: 1px solid rgba(30,64,175,0.8);
    box-shadow: var(--shadow-soft);
    font-size: 13px;
}
.admin-auth-card h1 {
    margin: 0 0 12px;
    font-size: 16px;
}
.admin-form label {
    display: block;
    margin-bottom: 10px;
    font-size: 12px;
}
.admin-form input,
.admin-form textarea,
.admin-form select {
    width: 100%;
    background: rgba(15,23,42,0.98);
    border-radius: 10px;
    border: 1px solid rgba(148,163,184,0.7);
    padding: 6px 9px;
    font-size: 12px;
    color: var(--text);
}
.admin-form textarea {
    resize: vertical;
}
.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(56,189,248,0.5);
}
.admin-form label.inline {
    display: flex;
    align-items: center;
    gap: 6px;
}
.admin-form label.inline input[type=checkbox] {
    width: auto;
}
.admin-form .btn.w-full {
    width: 100%;
}

.alert {
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 12px;
    margin-bottom: 10px;
}
.alert.danger {
    background: rgba(248,113,113,0.1);
    border: 1px solid rgba(248,113,113,0.5);
    color: #fecaca;
}

.admin-hint {
    font-size: 11px;
    color: var(--muted);
    margin-top: 8px;
}
.admin-hint code {
    font-size: 11px;
    background: rgba(15,23,42,0.98);
    padding: 2px 4px;
    border-radius: 4px;
    border: 1px solid rgba(30,64,175,0.7);
}
.admin-back {
    margin-top: 10px;
    font-size: 12px;
}
.admin-back a {
    color: var(--accent);
    text-decoration: none;
}

/* Admin layout */

.admin-layout {
    display: grid;
    grid-template-columns: 220px minmax(0,1fr);
    min-height: 100vh;
}

.admin-sidebar {
    padding: 14px 12px;
    background: radial-gradient(circle at top left, rgba(56,189,248,0.08), #020617 55%);
    border-right: 1px solid rgba(30,64,175,0.7);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.admin-sidebar .logo.small {
    margin-bottom: 10px;
}
.admin-sidebar nav a {
    display: block;
    font-size: 13px;
    padding: 7px 10px;
    border-radius: 8px;
    color: var(--muted);
    text-decoration: none;
    margin-bottom: 3px;
}
.admin-sidebar nav a:hover {
    background: rgba(15,23,42,0.95);
    color: #e0f2fe;
}
.admin-sidebar nav a.active {
    background: rgba(15,23,42,0.98);
    color: #e0f2fe;
    border: 1px solid rgba(56,189,248,0.7);
}
.logout-link {
    margin-top: auto;
    font-size: 12px;
    color: #fca5a5;
    text-decoration: none;
}

.admin-main {
    padding: 14px 16px 18px;
}
.admin-main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.admin-main-header h1 {
    margin: 0;
    font-size: 16px;
}
.admin-main-header .user {
    font-size: 12px;
    color: var(--muted);
}
.admin-content {
    font-size: 13px;
}
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(260px,1fr));
    gap: 10px;
}
.admin-card {
    border-radius: 16px;
    background: rgba(15,23,42,0.98);
    border: 1px solid rgba(30,64,175,0.7);
    padding: 12px 12px 10px;
    box-shadow: 0 16px 36px rgba(15,23,42,0.9);
}
.admin-card h2 {
    margin: 0 0 5px;
    font-size: 14px;
}
.admin-card p {
    margin: 0 0 8px;
    font-size: 12px;
    color: var(--muted);
}
.admin-card .btn {
    font-size: 12px;
}

/* Admin tables */

.admin-table {
    box-shadow: 0 16px 36px rgba(15,23,42,0.9);
}
.admin-table .rates-table th,
.admin-table .rates-table td {
    font-size: 11px;
}
.admin-table .rates-table td.small-text {
    font-size: 10px;
}
.admin-table .link {
    font-size: 11px;
    color: var(--accent);
    text-decoration: none;
    margin-right: 6px;
}
.admin-table .link.danger {
    color: #fca5a5;
}

/* Responsive */

@media (max-width: 900px) {
    .hero-grid {
        grid-template-columns: minmax(0,1fr);
    }
    .two-cols {
        grid-template-columns: minmax(0,1fr);
    }
    .admin-layout {
        grid-template-columns: minmax(0,1fr);
    }
    .admin-sidebar {
        display: none;
    }
    .admin-main {
        padding-top: 20px;
    }
}

@media (max-width: 720px) {
    .nav-container {
        flex-wrap: wrap;
        gap: 8px;
    }
    .main-nav {
        position: absolute;
        left: 0;
        right: 0;
        top: 60px;
        background: rgba(15,23,42,0.98);
        border-bottom: 1px solid rgba(30,64,175,0.7);
        padding: 8px 16px 10px;
        display: flex;
        flex-direction: column;
        gap: 6px;
        transform: translateY(-120%);
        opacity: 0;
        pointer-events: none;
        transition: all 0.16s ease;
    }
    .main-nav.open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }
    .nav-toggle {
        display: block;
    }
}
