/* =====================================================
   Cats Off The Grid — Dark Space Theme
   ===================================================== */

/* الوضع النهاري (الافتراضي) — هوية دافئة */
:root {
    --bg:            #faf7f2;
    --bg-2:          #f2ece3;
    --surface:       #ffffff;
    --surface-2:     #f6f1ea;
    --border:        #e7dfd3;
    --text:          #2a2622;
    --text-muted:    #7a7167;
    --accent:        #0e8f8a;
    --accent-2:      #0e8f8a;
    --accent-strong: #0b726e;
    --success:       #2e9e6b;
    --warning:       #c67b12;
    --danger:        #d14343;
    --radius:        14px;
    --radius-sm:     9px;
    --shadow:        0 10px 30px rgba(60, 45, 30, 0.10);
    --gradient:      linear-gradient(135deg, #13a69d, #0e8f8a);
    --amber:         #f4a259;
    --amber-strong:  #e8823a;
    --header-bg:     rgba(250, 247, 242, 0.85);
}
/* الوضع الليلي — فضائي نيلي */
[data-theme="dark"] {
    --bg:            #0a0e1f;
    --bg-2:          #0f1430;
    --surface:       #141a35;
    --surface-2:     #1c2447;
    --border:        #283056;
    --text:          #e8ecf8;
    --text-muted:    #9aa4cf;
    --accent:        #35d0c4;
    --accent-2:      #38bdf8;
    --accent-strong: #22b8ab;
    --success:       #4ade80;
    --warning:       #fbbf24;
    --danger:        #f87171;
    --shadow:        0 10px 30px rgba(0, 0, 0, 0.45);
    --amber:         #f4a259;
    --amber-strong:  #e8823a;
    --header-bg:     rgba(10, 14, 31, 0.85);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Tajawal', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}
/* الخلفية الافتراضية (نهاري دافئ) */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background: linear-gradient(180deg, #fdfbf7, #f5efe6);
}
/* خلفية النجوم الفضائية في الوضع الليلي */
[data-theme="dark"] body::before {
    background:
        linear-gradient(rgba(5,7,20,.45), rgba(5,7,20,.66)),
        url('../img/space-stars.jpg') center / cover no-repeat fixed;
}
/* توهّج ملوّن فوق النجوم */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(1000px 500px at 85% -10%, rgba(244,162,89,.16), transparent),
        radial-gradient(800px 460px at 0% 10%, rgba(14,143,138,.10), transparent);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container { width: 100%; max-width: 1160px; margin-inline: auto; padding-inline: 20px; }

.site-main { flex: 1 0 auto; padding-block: 32px; }

/* -------------------- Header -------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-block: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.12rem; margin-inline-end: auto; white-space: nowrap; }
.theme-toggle {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    transition: .2s;
}
.theme-toggle:hover { border-color: var(--accent); }
.brand-mark { font-size: 1.4rem; }
.accent { color: var(--accent); }
.brand .accent { color: var(--amber); }

.main-nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.main-nav a {
    padding: 7px 10px;
    border-radius: 999px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: .95rem;
    white-space: nowrap;
    transition: .2s;
}
.main-nav a:hover { color: var(--text); background: var(--surface); }
.main-nav .nav-cta {
    background: var(--amber);
    color: #3a2410;
    font-weight: 700;
}
.main-nav .nav-cta:hover { color: #3a2410; background: var(--amber-strong); }
.main-nav .nav-muted { color: var(--text-muted); }
.main-nav .nav-live { color: var(--danger); font-weight: 700; }
.main-nav .nav-live:hover { color: #fff; background: var(--danger); }

.nav-toggle {
    display: none;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 1.2rem;
    cursor: pointer;
}

/* -------------------- Nav dropdown -------------------- */
.has-dropdown { position: relative; display: inline-flex; }
.dropdown-toggle { cursor: pointer; }
.dropdown {
    display: none;
    position: absolute;
    top: 100%;
    inset-inline-end: 0;
    min-width: 200px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 6px;
    z-index: 60;
    box-shadow: var(--shadow);
}
.has-dropdown.open .dropdown { display: block; }
.dropdown a { display: block; border-radius: 8px; }

/* -------------------- Hero -------------------- */
.hero {
    position: relative;
    overflow: hidden;
    border-radius: 22px;
    padding: 64px 40px;
    margin-bottom: 40px;
    background:
        linear-gradient(180deg, rgba(6,9,25,.5), rgba(6,9,25,.8)),
        url('../img/space-hero.jpg') center / cover no-repeat;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.9rem); line-height: 1.25; margin-bottom: 14px; text-shadow: 0 2px 20px rgba(0,0,0,.6); color: #fff; }

/* -------------------- Hero video (LV-style full-bleed) -------------------- */
.hero-video {
    position: relative;
    overflow: hidden;
    width: 100vw;
    max-width: 100vw;
    margin-inline: calc(50% - 50vw);
    min-height: 90vh;
    display: flex;
    align-items: center;
    padding: 72px clamp(24px, 7vw, 110px);
}
.hero-video-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.hero-video-bg iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    height: 56.25vw;          /* 16:9 based on width */
    min-height: 100%;
    min-width: 177.78vh;      /* 16:9 based on height */
    pointer-events: none;
    border: 0;
}
.hero-video::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(180deg, rgba(6,9,25,.35), rgba(6,9,25,.78));
}
.hero-content { position: relative; z-index: 2; max-width: 620px; }
.hero-content h1 { font-size: clamp(1.9rem, 4.4vw, 3rem); line-height: 1.25; margin-bottom: 14px; color: #fff; text-shadow: 0 2px 22px rgba(0,0,0,.7); }
.hero-content p { color: rgba(255,255,255,.9); font-size: 1.08rem; margin-bottom: 26px; max-width: 560px; }
.hero-content .subtitle { color: rgba(255,255,255,.75); }
@media (max-width: 720px) { .hero-video { min-height: 76vh; padding: 44px 24px; } }
.hero p { color: rgba(255,255,255,.85); max-width: 560px; font-size: 1.08rem; margin-bottom: 26px; }
.hero .subtitle { color: rgba(255,255,255,.7); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn-outline { color: #fff; border-color: rgba(255,255,255,.55); }
.hero .btn-outline:hover { color: #fff; border-color: #fff; background: rgba(255,255,255,.12); }

/* -------------------- Buttons -------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 999px;
    font-weight: 700;
    font-family: inherit;
    font-size: 1rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: .2s;
}
.btn-primary { background: var(--gradient); color: #fff; }
.btn-primary:hover { opacity: .92; transform: translateY(-1px); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: rgba(248,113,113,.12); color: var(--danger); border-color: rgba(248,113,113,.4); }
.btn-danger:hover { background: rgba(248,113,113,.2); }
.btn-success { background: rgba(52,211,153,.12); color: var(--success); border-color: rgba(52,211,153,.4); }
.btn-success:hover { background: rgba(52,211,153,.2); }
.btn-sm { padding: 7px 14px; font-size: .88rem; }
.btn-ai {
    background: linear-gradient(135deg, #f4a259, #e8823a);
    color: #3a2410;
}
.btn-ai:hover { opacity: .92; }

/* -------------------- Section headings -------------------- */
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.section-head h2 { font-size: 1.6rem; }
.section-head p { color: var(--text-muted); font-size: .95rem; }
.subtitle { color: var(--text-muted); text-align: center; margin-bottom: 4px; letter-spacing: 2px; text-transform: uppercase; font-size: .8rem; }

/* -------------------- Cat grid & cards -------------------- */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 22px;
}
.cat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: .25s;
    display: flex;
    flex-direction: column;
}
.cat-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); }
.cat-card .thumb { aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg-2); }
.cat-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: .35s; }
.cat-card:hover .thumb img { transform: scale(1.06); }
.cat-card .body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.cat-card h3 { font-size: 1.15rem; }
.cat-card .meta { color: var(--text-muted); font-size: .9rem; display: flex; gap: 10px; flex-wrap: wrap; }
.cat-card .card-foot { margin-top: auto; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .8rem;
}

/* -------------------- Contact options (cat detail) -------------------- */
.contact-options {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
}
.contact-options .btn {
    flex: 1;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    padding-inline: 12px;
}
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.gthumb { width: 68px; height: 68px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); cursor: pointer; transition: .2s; }
.gthumb:hover { border-color: var(--accent); }
.cat-videos { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.cat-videos video { width: 100%; border-radius: 12px; border: 1px solid var(--border); background: #000; max-height: 420px; }
@media (max-width: 480px) {
    .contact-options { gap: 6px; }
    .contact-options .btn { padding: 10px 6px; font-size: .9rem; gap: 4px; }
}

/* -------------------- Badges -------------------- */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 700;
}
.badge-success { background: rgba(52,211,153,.15); color: var(--success); }
.badge-warning { background: rgba(251,191,36,.15); color: var(--warning); }
.badge-danger  { background: rgba(248,113,113,.15); color: var(--danger); }
.badge-muted   { background: var(--surface-2); color: var(--text-muted); }

/* -------------------- Forms -------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}
.form-narrow { max-width: 480px; margin-inline: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-group.full { grid-column: 1 / -1; }
label { font-weight: 500; font-size: .95rem; }
input, select, textarea {
    font-family: inherit;
    font-size: 1rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    width: 100%;
    transition: .2s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(14,143,138,.18);
}
textarea { resize: vertical; min-height: 100px; }
.checkbox-row { display: flex; gap: 20px; flex-wrap: wrap; }
.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.checkbox input { width: auto; }
.hint { color: var(--text-muted); font-size: .82rem; }
.form-actions { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }

/* -------------------- Filters -------------------- */
.filter-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    align-items: end;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 26px;
}

/* -------------------- Flash -------------------- */
.flash {
    padding: 13px 18px;
    border-radius: var(--radius-sm);
    margin-block: 14px;
    border: 1px solid var(--border);
    font-weight: 500;
}
.flash-success { background: rgba(52,211,153,.12); border-color: rgba(52,211,153,.4); color: var(--success); }
.flash-error   { background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.4); color: var(--danger); }
.flash-info    { background: rgba(56,189,248,.12); border-color: rgba(56,189,248,.4); color: var(--accent-2); }

/* -------------------- Detail page -------------------- */
.detail-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 30px; }
.detail-img { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--bg-2); }
.detail-img img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.specs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 20px 0; }
.spec {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}
.spec .k { color: var(--text-muted); font-size: .82rem; }
.spec .v { font-weight: 700; margin-top: 2px; }
.block-title { font-weight: 700; margin: 18px 0 6px; color: var(--accent); }

/* -------------------- Stats (admin) -------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
    margin-bottom: 30px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
}
.stat-card .num { font-size: 2rem; font-weight: 800; color: var(--accent); }
.stat-card .lbl { color: var(--text-muted); }

/* -------------------- Table -------------------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { padding: 13px 16px; text-align: right; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 700; font-size: .9rem; background: var(--bg-2); }
tr:last-child td { border-bottom: none; }
td .thumb-sm { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; }
.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }

/* -------------------- Tabs / dashboard -------------------- */
.dash-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; margin-bottom: 24px; }

/* -------------------- Empty state -------------------- */
.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}
.empty .big { font-size: 2.5rem; margin-bottom: 10px; }

/* -------------------- Footer -------------------- */
.site-footer {
    background: var(--bg-2);
    border-top: 1px solid var(--border);
    margin-top: 40px;
}
.footer-inner { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 30px; padding-block: 44px; align-items: start; }
.footer-brand { max-width: 340px; }
.footer-logo { display: flex; align-items: center; gap: 8px; font-size: 1.15rem; font-weight: 800; }
.footer-brand p { color: var(--text-muted); margin-top: 10px; line-height: 1.8; }
.footer-col { display: flex; flex-direction: column; gap: 10px; }
.footer-col h4 { color: var(--text); font-size: 1rem; margin-bottom: 4px; }
.footer-col a { color: var(--text-muted); transition: .2s; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid var(--border); text-align: center; padding: 16px; color: var(--text-muted); font-size: .88rem; }

.text-center { text-align: center; }
.mt { margin-top: 18px; }
.muted { color: var(--text-muted); }
.auth-switch { text-align: center; margin-top: 18px; color: var(--text-muted); }
.auth-switch a { color: var(--accent); font-weight: 600; }

/* -------------------- Responsive -------------------- */
@media (max-width: 820px) {
    .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .nav-toggle { display: block; }
    .main-nav {
        display: none;
        position: absolute;
        top: 64px;
        inset-inline: 0;
        flex-direction: column;
        align-items: stretch;
        background: var(--bg-2);
        border-bottom: 1px solid var(--border);
        padding: 12px 20px;
        gap: 4px;
    }
    .main-nav.open { display: flex; }
    .main-nav a { padding: 12px 14px; }
    .form-grid { grid-template-columns: 1fr; }
    .hero { padding: 44px 24px; }
    .has-dropdown { display: block; }
    .dropdown {
        position: static;
        box-shadow: none;
        border: none;
        background: transparent;
        padding-inline-start: 12px;
    }
    .footer-inner { grid-template-columns: 1fr 1fr; gap: 18px 20px; text-align: center; padding-block: 30px; }
    .footer-brand { grid-column: 1 / -1; max-width: none; margin-bottom: 4px; }
    .footer-logo { justify-content: center; }
    .footer-col { align-items: center; }
    .footer-col h4 { font-size: .95rem; }
}

/* -------------------- Nav badge -------------------- */
.nav-badge {
    display: inline-block;
    min-width: 18px;
    padding: 1px 6px;
    margin-inline-start: 4px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    text-align: center;
}

/* -------------------- Live streaming page -------------------- */
.live-stage {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    background:
        linear-gradient(180deg, rgba(20,14,10,.4), rgba(20,14,10,.82)),
        url('../img/hero-cat.jpg') center / cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: var(--shadow);
}
.live-stage .overlay { padding: 20px; }
.live-stage .live-dot {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(248,113,113,.15); color: var(--danger);
    border: 1px solid rgba(248,113,113,.4);
    padding: 6px 14px; border-radius: 999px; font-weight: 700; margin-bottom: 16px;
}
.live-stage .live-dot::before {
    content: ""; width: 9px; height: 9px; border-radius: 50%;
    background: var(--danger); animation: pulse 1.4s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.live-stage h2 { font-size: clamp(1.4rem, 3vw, 2.2rem); text-shadow: 0 2px 20px rgba(0,0,0,.6); color: #fff; }
.live-stage .overlay .muted { color: rgba(255,255,255,.85); }

/* -------------------- Internal chat -------------------- */
.chat-layout { display: grid; grid-template-columns: 300px 1fr; gap: 18px; }
.chat-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.chat-list a {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    padding: 14px 16px; border-bottom: 1px solid var(--border); transition: .2s;
}
.chat-list a:last-child { border-bottom: none; }
.chat-list a:hover, .chat-list a.active { background: var(--surface-2); }
.chat-list .who { font-weight: 700; }
.chat-list .last { color: var(--text-muted); font-size: .85rem; display: block; margin-top: 2px; }
.chat-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 460px; }
.chat-head { padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 700; }
.chat-body { flex: 1; padding: 18px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; max-height: 460px; }
.msg { max-width: 75%; padding: 10px 14px; border-radius: 14px; line-height: 1.6; }
.msg .time { display: block; font-size: .7rem; color: var(--text-muted); margin-top: 4px; }
.msg.mine { align-self: flex-start; background: var(--gradient); color: #fff; }
.msg.mine .time { color: rgba(255,255,255,.7); }
.msg.theirs { align-self: flex-end; background: var(--surface-2); border: 1px solid var(--border); }
.chat-form { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--border); }
.chat-form input { flex: 1; }
@media (max-width: 720px) {
    .chat-layout { grid-template-columns: 1fr; }
}
