/*
  Global site-wide styles: CSS variables, resets, and the shared nav/header.
  Loaded on every page via views/elements/head.ejs so it only ships once
  instead of being duplicated inline on each view.
*/

:root {
    --bg-dark: #0a0a0c;
    --bg-card: #121217;
    --bg-inverse: #0d1326;
    --primary: #5865F2;
    --primary-hover: #4752c4;
    --accent: #4bb7f0;
    --text-main: #ffffff;
    --text-dim: #a0a0a8;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-hover: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(88, 101, 242, 0.3);
    --max-width: 81.25rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Assistant', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    line-height: 1.6;
    padding-top: 5.3125rem;
    background-image:
        radial-gradient(circle at 5% 10%, rgba(88, 101, 242, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 95% 80%, rgba(79, 195, 247, 0.04) 0%, transparent 40%);
    transition: background-color 0.8s ease, background-image 0.8s ease;
}

body.loading-skeleton {
    overflow: hidden;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 5%;
}

@media (min-width: 1600px) {
    :root {
        --max-width: 87.5rem;
    }
}

@media (max-width: 64rem) {
    .nav-links {
        gap: 1.25rem;
    }
}

/* scrollbar */
::-webkit-scrollbar {
    width: 0.5rem;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0.25rem;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* ==========================================
   Navbar
   ========================================== */
nav#navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
    height: 5.3125rem;
    background: rgba(10, 10, 12, 0.7);
    backdrop-filter: blur(0.9375rem);
    -webkit-backdrop-filter: blur(0.9375rem);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    transition: all 0.4s ease;
    border-bottom: 0.0625rem solid var(--border);
}

.nav-right-group {
    display: flex;
    align-items: center;
    gap: 0.9375rem;
}

/* .nav-left מעולם לא היה צריך display:flex משלו כי הכיל תמיד ילד יחיד
   (הדרופדאון או כפתור ההתחברות) - זו הסיבה שהוספת כמה כפתורים לצידו גרמה
   להם "להיערם" זה מתחת לזה כבלוקים, בלי חוק flex שיישר אותם בשורה. */
.nav-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.nav-logo {
    width: 2.625rem;
    border-radius: 0.625rem;
    filter: drop-shadow(0 0 0.625rem rgba(88, 101, 242, 0.4));
}

.nav-brand {
    font-weight: 800;
    font-size: 1.35rem;
    background: linear-gradient(to right, #fff, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 2.1875rem;
    list-style: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav-links a {
    color: var(--text-dim);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: 0.3s;
}

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

.user-profile-dropdown {
    position: relative;
}

.user-trigger {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.375rem 1rem 0.375rem 0.375rem;
    background: var(--glass);
    color: var(--text-main);
    border-radius: 3.125rem;
    border: 0.0625rem solid var(--border);
    cursor: pointer;
    transition: 0.3s;
}

.user-trigger:hover {
    background: var(--glass-hover);
    border-color: var(--border-highlight);
}

.user-avatar {
    width: 2.125rem;
    height: 2.125rem;
    border-radius: 50%;
    border: 0.125rem solid var(--primary);
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 13.75rem;
    background: rgba(18, 18, 23, 0.98);
    backdrop-filter: blur(0.9375rem);
    border: 0.0625rem solid var(--border);
    border-radius: 1rem;
    padding: 0.5rem;
    display: none;
    flex-direction: column;
    box-shadow: 0 0.9375rem 2.5rem rgba(0, 0, 0, 0.6);
}

.dropdown-menu[dir="ltr"] {
    left: -10px;
}

.user-profile-dropdown.open .dropdown-menu {
    display: flex;
}

.user-profile-dropdown:focus-within .dropdown-menu {
    display: flex;
}

.dropdown-header {
    padding: 0.625rem 0.9375rem;
    font-size: 0.8rem;
    color: var(--text-dim);
    text-transform: uppercase;
}

.dropdown-item {
    padding: 0.75rem 0.9375rem;
    color: var(--text-main);
    text-decoration: none;
    border-radius: 0.625rem;
    font-size: 0.95rem;
    transition: 0.2s;
    display: flex;
    gap: 0.625rem;
}

.dropdown-item:hover {
    background: rgba(88, 101, 242, 0.15);
    color: var(--primary);
}

.dropdown-item.logout:hover {
    background: rgba(255, 69, 58, 0.15);
    color: #ff453a;
}

/* קישורי הניווט הכלליים בתוך תפריט המשתמש - גלויים רק במובייל (ראו את
   @media (max-width: 48rem) למטה), כי בדסקטופ אותם קישורים כבר גלויים
   ישירות בהדר (nav-links/nav-quicklinks/nav-dashboard-btn). */
.dropdown-mobile-links {
    display: none;
}

.dropdown-mobile-links .dropdown-item i {
    width: 1.1rem;
    text-align: center;
    color: var(--accent);
}

/* ==========================================
   מערכת כפתורים משותפת לכל האתר (.btn + variants). קיימת גם ב-dashboard.css/
   profile.css עם ערכים דומים לדפים שכבר טוענים אותם - זו נשארת כברירת מחדל
   לכל דף שלא טוען את הקבצים האלה (servers/premium/index/store-command/
   tickets-list ועוד), כדי שכפתור עם class="btn btn-outline" למשל לא ייצא
   בלי שום עיצוב סתם כי הדף לא טען CSS ספציפי שמגדיר את זה.
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    border: none;
    transition: 0.3s;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    padding: 0.625rem 1.5rem;
    border-radius: 0.75rem;
    text-decoration: none;
    font-weight: 600;
    transition: 0.3s;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-0.0625rem);
}

.btn-outline {
    background: var(--glass);
    border: 0.0625rem solid var(--border);
    color: var(--text-main);
    padding: 0.625rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    text-decoration: none;
}

.btn-outline:hover {
    background: var(--glass-hover);
    border-color: var(--border-highlight);
}

.btn-danger {
    background: rgba(237, 66, 69, 0.1);
    border: 0.0625rem solid rgba(237, 66, 69, 0.3);
    color: #ED4245;
    padding: 0.625rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    text-decoration: none;
}

.btn-danger:hover {
    background: #ED4245;
    color: #fff;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.82rem;
    border-radius: 0.6rem;
}

.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.form-control {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 0.0625rem solid var(--border);
    color: var(--text-main);
    padding: 0.85rem 1.2rem;
    border-radius: 0.75rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.1875rem rgba(88, 101, 242, 0.15);
    outline: none;
    background: rgba(0, 0, 0, 0.4);
}

/* קישורי קיצור דרך בהדר (Store/Premium) - זמינים תמיד, בכל עמוד */
.nav-quicklinks {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* קישורי קיצור אייקון-בלבד (השם המלא מופיע כ-tooltip דרך ה-title) - במכוון
   קומפקטיים ועדינים, כדי שלא "יפריעו" ולא יתחרו ויזואלית עם כפתור הדשבורד */
.nav-quicklink {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    background: var(--glass);
    border: 0.0625rem solid var(--border);
    color: var(--text-dim);
    text-decoration: none;
    font-size: 1rem;
    transition: 0.2s ease;
}

.nav-quicklink span {
    display: none;
}

.nav-quicklink:hover {
    background: var(--glass-hover);
    border-color: var(--border-highlight);
    color: var(--accent);
}

/* כפתור הדשבורד - במכוון שונה ויזואלית מקישורי הקיצור הרגילים (גרדיאנט
   ממותג במקום ghost-style), כדי שיבלוט כפעולה המרכזית ולא יטמע כעוד שורה
   אחידה של קישורי טקסט - זה מה שאמור לפתור את בעיית ה"לא כולם ידעו איפה זה". */
.nav-dashboard-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border-radius: 0.7rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 0.25rem 0.9rem rgba(88, 101, 242, 0.35);
    transition: 0.25s ease;
    white-space: nowrap;
}

.nav-dashboard-btn:hover {
    transform: translateY(-0.0625rem);
    box-shadow: 0 0.4rem 1.2rem rgba(88, 101, 242, 0.45);
}

@keyframes dropFade {
    from {
        opacity: 0;
        transform: translateY(-0.625rem);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* כפתור ההמבורגר לתפריט המובייל של האתר הכללי (לא הדשבורד) - מוסתר
   בדסקטופ, כי שם nav-links כבר גלוי ישירות בהדר. */
.site-nav-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    margin-inline-end: 0.3rem;
}

.site-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.site-nav-overlay.open { display: block; opacity: 1; }

.site-mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    position: fixed;
    top: 5.3125rem;
    inset-inline: 0;
    background: rgba(10, 10, 12, 0.98);
    backdrop-filter: blur(0.9375rem);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 5%;
    z-index: 999;
    transform: translateY(-110%);
    transition: transform 0.25s ease;
    max-height: calc(100vh - 5.3125rem);
    overflow-y: auto;
}
.site-mobile-nav.open { transform: translateY(0); }
.site-mobile-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.85rem 0.5rem;
    border-radius: 0.6rem;
}
.site-mobile-nav a i { width: 1.3rem; text-align: center; color: var(--accent); }
.site-mobile-nav a:hover { background: var(--glass-hover); }
.site-mobile-nav hr { border: 0; border-top: 1px solid var(--border); margin: 0.4rem 0; }

@media (max-width: 48rem) {
    .nav-links {
        display: none;
    }

    .site-nav-toggle {
        display: inline-flex;
        align-items: center;
    }

    .user-name {
        display: none;
    }

    .user-trigger {
        padding: 0.25rem;
        border-radius: 50%;
    }

    .dropdown-menu[dir="ltr"] {
        left: -150px;
    }

    .dropdown-mobile-links {
        display: flex;
        flex-direction: column;
    }

    /* כפתור הדשבורד הופך לאייקון בלבד (בלי טקסט) במסכים צרים, כדי לא לצפוף
       את ההדר - קישורי הקיצור כבר אייקון-בלבד תמיד, לא צריך לשנות אותם כאן */
    .nav-dashboard-btn span {
        display: none;
    }

    .nav-dashboard-btn {
        padding: 0.55rem 0.7rem;
        margin-inline-end: 0.4rem;
    }
}

@media (max-width: 30rem) {
    .nav-quicklinks {
        display: none;
    }
}

/* ==========================================
   Loading skeletons - used while the dashboard and other pages fetch data
   ========================================== */
.skeleton {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    pointer-events: none;
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0,
            rgba(255, 255, 255, 0.06) 20%,
            rgba(255, 255, 255, 0.06) 60%,
            rgba(255, 255, 255, 0) 100%);
    animation: shimmer 1.8s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

.skel-nav-item {
    height: 45px;
    margin-bottom: 10px;
    border-radius: 10px;
}

.skel-title {
    height: 40px;
    width: 250px;
    margin-bottom: 30px;
    border-radius: 8px;
}

.skel-card-title {
    height: 26px;
    width: 180px;
    margin-bottom: 20px;
    border-radius: 6px;
}

.skel-text-sm {
    height: 16px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skel-input {
    height: 48px;
    width: 100%;
    border-radius: 12px;
}

/* ==========================================
   Accessibility - focus rings and the tooltip acces.js renders
   ========================================== */
:where(
    button,
    a,
    input,
    textarea,
    select,
    summary,
    [role="button"],
    [role="tab"],
    [tabindex]:not([tabindex="-1"])
):focus-visible {
    outline: none;
    box-shadow:
        0 0 0 3px #c5d7ff,
        0 0 0 6px rgba(37,99,235,.25);
    border-radius: 10px;
}

:where(
    button,
    a,
    input,
    textarea,
    select,
    summary,
    [role="button"],
    [role="tab"],
    [tabindex]:not([tabindex="-1"])
) {
    transition: box-shadow .15s ease, transform .15s ease;
}

.switch input:focus-visible + .slider {
    box-shadow:
        0 0 0 3px #c5d7ff,
        0 0 0 6px rgba(37,99,235,.25);
}

:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 3px #c5d7ff,
        0 0 0 6px rgba(37,99,235,.25);
    border-radius: 8px;
}

.a11y-tooltip {
    background: #111827;
    color: white;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 12px;
    z-index: 99999;
    box-shadow: 0 10px 30px rgba(0,0,0,.3);
}

/* ==========================================
   Empty state - shared icon + title + description + CTA, used wherever a
   list is empty (no commands, no servers, no search results, etc.).
   ========================================== */
.empty-state-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2.75rem 1.5rem;
    gap: 0.35rem;
}
.empty-state-icon {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(88, 101, 242, 0.18), rgba(139, 92, 246, 0.14));
    border: 1px solid var(--border-highlight, rgba(88, 101, 242, 0.3));
    color: var(--accent, #4bb7f0);
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}
.empty-state-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main, #fff);
}
.empty-state-desc {
    font-size: 0.88rem;
    color: var(--text-dim, #a0a0a8);
    max-width: 26rem;
    line-height: 1.6;
}
.empty-state-cta {
    margin-top: 0.9rem;
}

/* ==========================================
   Field tooltip - small (i) button next to complex field labels, with an
   explanation bubble. The bubble is position:fixed and positioned by
   public/js_src/field-tip.js (computes exact viewport coordinates on every
   show) rather than position:absolute with CSS hover/focus alone, because
   scroll containers like .main-content (overflow-y:auto) also clip
   overflow-x automatically per the CSS spec, which cut the bubble off at
   screen/card edges. position:fixed escapes normal ancestor overflow clipping.
   ========================================== */
.field-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    margin-inline-start: 0.4rem;
    padding: 0;
    border: none;
    background: none;
    border-radius: 50%;
    color: var(--text-dim, #a0a0a8);
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    font-size: 0.95rem;
    line-height: 1;
    transition: color 0.15s;
}
.field-tip:hover,
.field-tip:focus {
    color: var(--accent, #4bb7f0);
}
.field-tip-bubble {
    display: none;
    position: fixed;
    width: max-content;
    max-width: 16rem;
    background: #1c1c24;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    color: #e1e1e6;
    font-weight: 400;
    font-size: 0.78rem;
    line-height: 1.5;
    padding: 0.55rem 0.75rem;
    border-radius: 0.6rem;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.4);
    z-index: 9999;
    text-align: start;
    white-space: normal;
}
.field-tip-bubble.show {
    display: block;
}
@media (max-width: 30rem) {
    .field-tip-bubble {
        max-width: 13rem;
    }
}
