:root {
    --bg-color: #050506;
    --panel-bg: #0c0c0e;
    --text-color: #f3efe6;
    --muted: #8a8a92;
    --gold: #b39359;
    --gold-hover: #d4b87a;
    --danger: #ef4444;
    --success: #22c55e;
    --line: rgba(255, 255, 255, 0.08);
    --font: 'IBM Plex Sans Arabic', 'Tajawal', sans-serif;
}

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

body.hub-body,
body {
    font-family: var(--font);
    background:
        radial-gradient(ellipse 80% 50% at 100% 0%, rgba(179, 147, 89, 0.08), transparent 55%),
        radial-gradient(ellipse 60% 40% at 0% 100%, rgba(90, 122, 154, 0.07), transparent 50%),
        var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    line-height: 1.65;
}

:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}

.skip-link {
    position: absolute;
    top: -100px;
    right: 1rem;
    z-index: 10000;
    background: var(--gold);
    color: #1a140c;
    padding: 0.65rem 1rem;
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.hub-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 2rem;
    background: rgba(12, 12, 14, 0.85);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.hub-nav { display: flex; gap: 0.55rem; flex-wrap: wrap; }

.logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gold);
    text-decoration: none;
    letter-spacing: 0.02em;
}
.logo-text { color: var(--muted); font-weight: 500; }

.btn-home {
    background: transparent;
    border: 1px solid rgba(179, 147, 89, 0.45);
    color: var(--gold);
    padding: 0.45rem 0.95rem;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
    font-size: 0.92rem;
    font-weight: 600;
}
.btn-home:hover {
    background: var(--gold);
    color: #1a140c;
    border-color: var(--gold);
}

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 2.5rem 1.25rem 4rem;
}

.hub-hero {
    text-align: center;
    margin: 0.5rem auto 2.5rem;
    max-width: 640px;
}
.hub-kicker {
    color: var(--gold);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin: 0 0 0.6rem;
}
.hub-lead,
.hub-hero p,
.tool-desc {
    color: var(--muted);
    line-height: 1.7;
    margin: 0.75rem 0 0;
}

.hub-search-label {
    display: block;
    margin-top: 1.25rem;
}

.hub-search {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    display: block;
    font-family: inherit;
    font-size: 0.95rem;
    padding: 0.7rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-color);
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.hub-search::placeholder { color: rgba(138, 138, 146, 0.85); }
.hub-search:focus {
    border-color: rgba(179, 147, 89, 0.55);
    background: rgba(255, 255, 255, 0.06);
}

.hub-results {
    margin: 0.95rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 500;
}

.hub-hero .hub-quick-panel {
    margin-top: 1.25rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.hub-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.18rem 0.55rem;
    border-radius: 6px;
    margin-bottom: 0.65rem;
}

.hub-badge-local {
    color: #9ec5b0;
    border: 1px solid rgba(158, 197, 176, 0.35);
    background: rgba(34, 197, 94, 0.08);
}

.hub-badge-cloud {
    color: var(--gold);
    border: 1px solid rgba(179, 147, 89, 0.4);
    background: rgba(179, 147, 89, 0.1);
}

.hub-empty {
    text-align: center;
    padding: 2.5rem 1.25rem;
    border: 1px dashed var(--line);
    border-radius: 14px;
    background: rgba(12, 12, 14, 0.6);
    margin: 0.5rem 0 2rem;
}

.hub-empty-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-color);
}

.hub-empty-desc {
    margin: 0.55rem 0 1.1rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.hub-empty-reset {
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 10px;
    padding: 0.45rem 1rem;
    cursor: pointer;
    border: 1px solid rgba(179, 147, 89, 0.45);
    background: transparent;
    color: var(--gold);
}

.hub-empty-reset:hover {
    background: var(--gold);
    color: #1a140c;
    border-color: var(--gold);
}

.ext-tool-card[hidden] { display: none !important; }
section[hidden] { display: none !important; }

.page-title-main {
    font-size: clamp(2rem, 4vw, 2.75rem);
    color: var(--text-color);
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.section-title {
    color: var(--gold);
    font-size: 1.15rem;
    font-weight: 700;
    margin: 2.5rem 0 1.1rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--line);
}

.section-desc {
    text-align: center;
    color: var(--muted);
    margin: -0.4rem 0 1.4rem;
    font-size: 0.98rem;
    line-height: 1.65;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}
.tools-grid-ext { margin-bottom: 0.5rem; }

.ext-tool-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    background: var(--panel-bg);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1.35rem 1.25rem;
    transition: border-color 0.25s ease, transform 0.25s ease, background 0.25s ease;
    text-decoration: none;
    color: inherit;
    min-height: 140px;
    position: relative;
}
.ext-tool-card:hover {
    transform: translateY(-3px);
    border-color: rgba(179, 147, 89, 0.45);
    background: #121215;
}

.ext-tool-mark {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.08em;
    margin-bottom: 0.85rem;
    opacity: 0.9;
}

.ext-tool-title {
    font-size: 1.05rem;
    color: var(--text-color);
    font-weight: 700;
    line-height: 1.35;
}

.hub-tag {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--gold);
    border: 1px solid rgba(179, 147, 89, 0.35);
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    margin-bottom: 0.55rem;
    letter-spacing: 0.06em;
}

.hub-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 1.1rem;
}

.hub-filter-btn {
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.4rem 0.85rem;
    cursor: pointer;
    border: 1px solid rgba(179, 147, 89, 0.4);
    background: transparent;
    color: var(--gold);
}

.hub-filter-btn.is-active {
    background: var(--gold);
    color: #1a140c;
    border-color: transparent;
}

.tool-card {
    background: var(--panel-bg);
    border: 1px solid rgba(179, 147, 89, 0.25);
    border-radius: 14px;
    padding: 1.5rem;
}

.calc-result-label { color: #ccc; font-size: 0.9em; }
h1 { color: var(--gold); text-align: center; font-size: 2.5em; margin-bottom: 10px; }
.calc-group { margin-bottom: 15px; }
.calc-group label { display: block; font-size: 0.95em; color: #ccc; margin-bottom: 8px; }
.calc-group input {
    width: 100%; padding: 12px; background: rgba(255,255,255,0.05);
    border: 1px solid #333; border-radius: 8px; color: #fff; box-sizing: border-box; outline: none; font-size: 1.1em;
}
.calc-group input:focus { border-color: var(--gold); }
.calc-btn {
    width: 100%; padding: 12px; background: var(--gold); color: #1a140c;
    border: none; border-radius: 8px; font-weight: bold; cursor: pointer; transition: 0.3s; margin-top: 15px; font-size: 1.1em;
}
.calc-btn:hover { background: var(--gold-hover); }
.calc-result {
    margin-top: 20px; padding: 15px; background: rgba(179, 147, 89, 0.1);
    border-radius: 8px; border: 1px solid rgba(179, 147, 89, 0.3); display: none; text-align: center;
}
.calc-result span { display: block; font-size: 1.8em; font-weight: bold; color: var(--success); margin-top: 5px; }
.danger-text { color: var(--danger) !important; }

@media (max-width: 640px) {
    .hub-header { padding: 0.9rem 1rem; }
    .page-title-main { font-size: 1.75rem; }
}
