:root {
    --bg-main: #07111f;
    --bg-secondary: #0c1b2d;
    --surface: rgba(17, 34, 55, 0.68);
    --surface-strong: rgba(20, 42, 68, 0.9);
    --surface-soft: rgba(255, 255, 255, 0.055);
    --border: rgba(255, 255, 255, 0.12);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-soft: #cbd5e1;
    --primary: #38bdf8;
    --primary-dark: #0284c7;
    --success: #4ade80;
    --danger: #fb7185;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
    --radius-lg: 24px;
    --radius-md: 16px;
    --transition: 220ms ease;
}

html[data-theme="light"] {
    --bg-main: #eef5fb;
    --bg-secondary: #dfeef9;
    --surface: rgba(255, 255, 255, 0.70);
    --surface-strong: rgba(255, 255, 255, 0.92);
    --surface-soft: rgba(15, 23, 42, 0.055);
    --border: rgba(15, 23, 42, 0.12);
    --text-main: #122033;
    --text-muted: #64748b;
    --text-soft: #334155;
    --primary: #0284c7;
    --primary-dark: #0369a1;
    --shadow: 0 24px 70px rgba(30, 64, 88, 0.16);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    direction: rtl;
    font-family: var(--font-family-base);
    color: var(--text-main);
    background:
        radial-gradient(circle at 15% 15%, rgba(14, 165, 233, 0.16), transparent 28%),
        radial-gradient(circle at 85% 80%, rgba(124, 58, 237, 0.12), transparent 28%),
        var(--bg-main);
    transition:
        background-color var(--transition),
        color var(--transition);
}

button,
input {
    font-family: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
}

.glass {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Application layout */

.app-layout {
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    z-index: 1000;
    top: 0;
    right: 0;
    bottom: 0;
    width: 286px;
    padding: 20px 16px;
    overflow-y: auto;
    background: var(--surface-strong);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    transform: translateX(105%);
    transition: transform var(--transition);
}

.app-sidebar.is-open {
    transform: translateX(0);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 8px 22px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 15px;
    color: #fff;
    font-size: 23px;
    background: linear-gradient(135deg, #38bdf8, #2563eb);
    box-shadow: 0 10px 28px rgba(14, 165, 233, 0.3);
}

.brand-title {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
}

.brand-caption {
    margin: 5px 0 0;
    color: var(--text-muted);
    font-size: 10px;
}

.sidebar-close {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin-right: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-soft);
    background: var(--surface-soft);
    cursor: pointer;
}

.sidebar-section-title {
    padding: 0 10px;
    margin: 22px 0 8px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: bold;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 45px;
    padding: 0 13px;
    border: 1px solid transparent;
    border-radius: 13px;
    color: var(--text-soft);
    text-decoration: none;
    font-size: 12px;
    transition: all var(--transition);
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-main);
    background: rgba(56, 189, 248, 0.13);
    border-color: rgba(56, 189, 248, 0.24);
    transform: translateX(-2px);
}

.nav-icon {
    width: 22px;
    text-align: center;
    font-size: 17px;
}

.sidebar-footer {
    margin-top: 28px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 15px;
    color: var(--text-muted);
    font-size: 10px;
    line-height: 2;
}

.app-main {
    min-width: 0;
    min-height: 100vh;
}

.app-topbar {
    position: sticky;
    z-index: 900;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    padding: 14px 18px;
    background: color-mix(in srgb, var(--bg-main) 78%, transparent);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.topbar-start,
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-toggle,
.theme-toggle {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 13px;
    color: var(--text-main);
    background: var(--surface-soft);
    cursor: pointer;
    font-size: 18px;
    transition: all var(--transition);
}

.menu-toggle:hover,
.theme-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.menu-toggle {
    display: grid;
}

.topbar-title {
    margin: 0;
    font-size: 14px;
    font-weight: bold;
}

.topbar-subtitle {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 10px;
}

.page-content {
    width: 100%;
    max-width: 1500px;
    padding: 24px 18px 40px;
    margin: 0 auto;
}

.drawer-overlay {
    position: fixed;
    z-index: 950;
    inset: 0;
    background: rgba(2, 6, 23, 0.58);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.drawer-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

body.drawer-locked {
    overflow: hidden;
}

/* Login page */

.auth-page {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
    overflow: hidden;
}

.auth-orb {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(5px);
    opacity: 0.45;
    pointer-events: none;
}

.auth-orb-one {
    top: -110px;
    right: -80px;
    background: #0ea5e9;
}

.auth-orb-two {
    bottom: -130px;
    left: -90px;
    background: #7c3aed;
}

.auth-header-actions {
    position: absolute;
    z-index: 2;
    top: 22px;
    left: 22px;
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    padding: 34px;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

.auth-brand {
    margin-bottom: 28px;
    text-align: center;
}

.auth-brand .brand-mark {
    margin: 0 auto 15px;
}

.auth-title {
    margin: 0;
    font-size: 22px;
}

.auth-description {
    margin: 10px 0 0;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 2;
}

.form-group {
    margin-bottom: 17px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: bold;
}

.form-input {
    width: 100%;
    height: 49px;
    padding: 0 15px;
    border: 1px solid var(--border);
    border-radius: 13px;
    outline: none;
    color: var(--text-main);
    background: var(--surface-soft);
    direction: rtl;
    transition: all var(--transition);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.11);
}

.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 7px 0 22px;
    color: var(--text-muted);
    font-size: 11px;
}

.auth-options label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.auth-options a {
    color: var(--primary);
    text-decoration: none;
}

.primary-button {
    width: 100%;
    height: 50px;
    border: 0;
    border-radius: 13px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 12px 28px rgba(2, 132, 199, 0.25);
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: all var(--transition);
}

.primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(2, 132, 199, 0.35);
}

.auth-footer {
    margin-top: 25px;
    color: var(--text-muted);
    text-align: center;
    font-size: 10px;
}

/* Desktop */

@media (min-width: 992px) {
    .app-sidebar {
        transform: translateX(0);
    }

    .app-main {
        margin-right: 286px;
    }

    .sidebar-close,
    .menu-toggle,
    .drawer-overlay {
        display: none;
    }

    .app-topbar {
        padding-right: 30px;
        padding-left: 30px;
    }

    .page-content {
        padding: 30px;
    }
}

/* Mobile */

@media (max-width: 600px) {
    .auth-page {
        padding: 16px;
    }

    .auth-card {
        padding: 26px 20px;
    }

    .auth-header-actions {
        top: 16px;
        left: 16px;
    }

    .page-content {
        padding: 18px 13px 30px;
    }

    .app-topbar {
        min-height: 65px;
        padding: 11px 13px;
    }

    .topbar-title {
        font-size: 12px;
    }

    .topbar-subtitle {
        display: none;
    }
}
