* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

:root {
    --bg: #02070c;
    --bg-2: #01050a;
    --bg-soft: #07131b;

    --card: rgba(8, 20, 28, 0.78);
    --card-hover: rgba(10, 28, 35, 0.95);

    --border: rgba(43, 255, 230, 0.12);
    --border-strong: rgba(43, 255, 230, 0.22);

    --primary: #19e6d1;
    --primary-dark: #11c7b5;

    --text: #f3f7fa;
    --muted: #97a6b3;

    --shadow: 0 0 30px rgba(25, 230, 209, 0.12);

    --header-bg: rgba(2, 7, 12, 0.82);

    --soft-btn: rgba(255, 255, 255, 0.02);
    --soft-btn-border: rgba(255, 255, 255, 0.08);

    --overlay: rgba(0, 0, 0, 0.55);
}

html.light-mode {
    --bg: #eff6fb;
    --bg-2: #ddeaf5;
    --bg-soft: #ffffff;

    --card: rgba(255, 255, 255, 0.88);
    --card-hover: rgba(255, 255, 255, 0.98);

    --border: rgba(17, 199, 181, 0.14);
    --border-strong: rgba(17, 199, 181, 0.28);

    --primary: #0fb9a8;
    --primary-dark: #0b9c8e;

    --text: #10202b;
    --muted: #607381;

    --shadow: 0 10px 30px rgba(16, 32, 43, 0.08);

    --header-bg: rgba(255, 255, 255, 0.82);

    --soft-btn: rgba(16, 32, 43, 0.03);
    --soft-btn-border: rgba(16, 32, 43, 0.08);

    --overlay: rgba(10, 20, 30, 0.22);
}

body {
    font-family: 'Cairo', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--text);
    background:
        radial-gradient(circle at 15% 20%, rgba(25, 230, 209, 0.12), transparent 28%),
        radial-gradient(circle at 85% 80%, rgba(25, 230, 209, 0.08), transparent 25%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
    transition: background 0.3s ease, color 0.3s ease;
}

html[dir="rtl"] body,
body.rtl {
    direction: rtl;
}

html[dir="ltr"] body,
body.ltr {
    direction: ltr;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
}

.container {
    width: min(1200px, calc(100% - 40px));
    margin: 0 auto;
}

.page-content {
    min-height: calc(100vh - 82px);
}

/* Header */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--header-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: background 0.3s ease;
}

html.light-mode .site-header {
    border-bottom-color: rgba(16, 32, 43, 0.06);
}

.navbar {
    min-height: 82px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "brand center actions";
    align-items: center;
    gap: 20px;
    direction: ltr;
}

.brand-wrap {
    grid-area: brand;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.center-nav {
    grid-area: center;
    display: flex;
    align-items: center;
    justify-content: center;
    direction: rtl;
}

.nav-actions {
    grid-area: actions;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

html[dir="rtl"] .navbar,
body.rtl .navbar {
    grid-template-areas: "brand center actions";
    direction: ltr;
}

html[dir="rtl"] .brand-wrap,
body.rtl .brand-wrap {
    justify-content: flex-start;
}

html[dir="rtl"] .center-nav,
body.rtl .center-nav {
    direction: rtl;
}

html[dir="rtl"] .nav-actions,
body.rtl .nav-actions {
    justify-content: flex-end;
}

html[dir="ltr"] .navbar,
body.ltr .navbar {
    grid-template-areas: "actions center brand";
    direction: ltr;
}

html[dir="ltr"] .brand-wrap,
body.ltr .brand-wrap {
    justify-content: flex-end;
}

html[dir="ltr"] .center-nav,
body.ltr .center-nav {
    direction: ltr;
}

html[dir="ltr"] .nav-actions,
body.ltr .nav-actions {
    justify-content: flex-start;
}

/* Brand */

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 25px;
    font-weight: 800;
    color: var(--primary);
    direction: ltr;
}

html[dir="rtl"] .brand,
body.rtl .brand {
    flex-direction: row;
}

html[dir="ltr"] .brand,
body.ltr .brand {
    flex-direction: row-reverse;
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #031116;
    font-size: 22px;
    box-shadow: var(--shadow);
}

/* Navigation */

.nav-links {
    display: flex;
    align-items: center;
    gap: 34px;
    list-style: none;
}

html[dir="rtl"] .nav-links,
body.rtl .nav-links {
    direction: rtl;
}

html[dir="ltr"] .nav-links,
body.ltr .nav-links {
    direction: ltr;
}

.nav-links a {
    position: relative;
    color: color-mix(in srgb, var(--text) 72%, transparent);
    font-size: 15px;
    font-weight: 800;
    transition: 0.25s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
}

.nav-links a.active::after {
    content: "";
    position: absolute;
    right: 0;
    left: 0;
    bottom: -10px;
    width: 100%;
    height: 2px;
    margin: auto;
    border-radius: 999px;
    background: var(--primary);
    box-shadow: 0 0 12px rgba(25, 230, 209, 0.7);
}

/* Buttons */

.btn {
    min-height: 46px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.25s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #031116;
    box-shadow: 0 10px 30px rgba(25, 230, 209, 0.22);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(25, 230, 209, 0.3);
}

.btn-dark {
    background: var(--soft-btn);
    border-color: var(--soft-btn-border);
    color: var(--text);
}

.btn-dark:hover {
    border-color: var(--border-strong);
    color: var(--primary);
}

.icon-btn {
    width: 46px;
    height: 46px;
    border: 1px solid var(--soft-btn-border);
    border-radius: 14px;
    background: var(--soft-btn);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
    cursor: pointer;
    transition: 0.25s ease;
}

.icon-btn:hover {
    border-color: var(--border-strong);
    color: var(--primary);
}

/* Sidebar */

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 199;
    background: var(--overlay);
    opacity: 0;
    visibility: hidden;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    transition: 0.25s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 0;
    z-index: 200;
    width: 320px;
    max-width: calc(100vw - 24px);
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(7, 19, 27, 0.98), rgba(4, 12, 18, 0.98));
    transition: transform 0.3s ease;
    will-change: transform;
}

@supports (height: 100dvh) {
    .sidebar {
        height: 100dvh;
        min-height: 100dvh;
        max-height: 100dvh;
    }
}

html.light-mode .sidebar {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 250, 255, 0.98));
}

html[dir="rtl"] .sidebar,
body.rtl .sidebar {
    right: 0 !important;
    left: auto !important;
    border-right: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.35);
    transform: translateX(100%);
}

html[dir="rtl"] .sidebar.active,
body.rtl .sidebar.active {
    transform: translateX(0) !important;
}

html[dir="ltr"] .sidebar,
body.ltr .sidebar {
    right: auto !important;
    left: 0 !important;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    border-left: 0;
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.35);
    transform: translateX(-100%);
}

html[dir="ltr"] .sidebar.active,
body.ltr .sidebar.active {
    transform: translateX(0) !important;
}

html.light-mode[dir="rtl"] .sidebar,
html.light-mode body.rtl .sidebar {
    border-right: 0;
    border-left: 1px solid rgba(16, 32, 43, 0.06);
    box-shadow: -10px 0 40px rgba(16, 32, 43, 0.10);
}

html.light-mode[dir="ltr"] .sidebar,
html.light-mode body.ltr .sidebar {
    border-right: 1px solid rgba(16, 32, 43, 0.06);
    border-left: 0;
    box-shadow: 10px 0 40px rgba(16, 32, 43, 0.10);
}

.sidebar-header {
    padding: 22px 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

html.light-mode .sidebar-header {
    border-bottom-color: rgba(16, 32, 43, 0.06);
}

.sidebar-user {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-user strong {
    color: var(--text);
    font-size: 17px;
    font-weight: 900;
}

.sidebar-user span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.sidebar-close {
    width: 40px;
    height: 40px;
    border: 1px solid var(--soft-btn-border);
    border-radius: 12px;
    background: var(--soft-btn);
    color: var(--text);
    flex-shrink: 0;
    font-size: 22px;
    cursor: pointer;
    transition: 0.25s ease;
}

.sidebar-close:hover {
    border-color: var(--border-strong);
    color: var(--primary);
}

.sidebar-menu {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
}

.sidebar-link {
    padding: 14px 16px;
    border: 1px solid var(--soft-btn-border);
    border-radius: 16px;
    background: var(--soft-btn);
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 800;
    transition: 0.25s ease;
}

.sidebar-link:hover {
    background: rgba(25, 230, 209, 0.08);
    border-color: rgba(25, 230, 209, 0.16);
    color: var(--primary);
    transform: translateX(-2px);
}

html[dir="ltr"] .sidebar-link:hover,
body.ltr .sidebar-link:hover {
    transform: translateX(2px);
}

.sidebar-icon {
    width: 22px;
    flex-shrink: 0;
    text-align: center;
}

.logout-form {
    margin-top: 8px;
}

.logout-btn {
    width: 100%;
    min-height: 52px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, #ff8f8f, #ff6767);
    color: #2d0909;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(255, 103, 103, 0.18);
    transition: 0.25s ease;
}

.logout-btn:hover {
    transform: translateY(-2px);
}

/* Push Notifications Permission Card */

.push-permission-card {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 9998;
    width: min(420px, calc(100% - 36px));
    padding: 14px;
    border-radius: 20px;
    border: 1px solid rgba(25, 230, 209, 0.22);
    background:
        linear-gradient(135deg, rgba(9, 18, 26, 0.96), rgba(8, 25, 31, 0.94));
    color: #ffffff;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.26);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 12px;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: 0.25s ease;
}

.push-permission-card.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

body.ltr .push-permission-card {
    right: auto;
    left: 18px;
}

.push-permission-icon {
    width: 44px;
    height: 44px;
    border-radius: 15px;
    background: rgba(25, 230, 209, 0.14);
    color: var(--primary);
    display: grid;
    place-items: center;
    font-size: 20px;
    box-shadow: 0 10px 24px rgba(25, 230, 209, 0.12);
}

.push-permission-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.push-permission-content strong {
    color: #ffffff;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.5;
}

.push-permission-content span {
    color: #aebdc7;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.7;
}

.push-permission-actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 4px;
}

body.ltr .push-permission-actions {
    justify-content: flex-start;
}

.push-permission-btn {
    min-height: 38px;
    border-radius: 999px;
    padding: 0 15px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    transition: 0.2s ease;
}

.push-permission-btn:disabled {
    opacity: 0.65;
    cursor: wait;
}

.push-permission-later {
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.04);
    color: #d6e2e8;
}

.push-permission-later:hover {
    border-color: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.push-permission-enable {
    border: 1px solid rgba(25, 230, 209, 0.36);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #031116;
    box-shadow: 0 10px 24px rgba(25, 230, 209, 0.18);
}

.push-permission-enable:hover {
    transform: translateY(-1px);
    box-shadow: 0 13px 28px rgba(25, 230, 209, 0.25);
}

html.light-mode .push-permission-card {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(242, 251, 250, 0.96));
    border-color: rgba(16, 185, 168, 0.18);
    box-shadow: 0 18px 42px rgba(16, 32, 43, 0.14);
}

html.light-mode .push-permission-content strong {
    color: #10202b;
}

html.light-mode .push-permission-content span {
    color: #607381;
}

html.light-mode .push-permission-later {
    background: rgba(16, 32, 43, 0.04);
    border-color: rgba(16, 32, 43, 0.08);
    color: #425466;
}

/* Push Toast */

.push-toast {
    position: fixed;
    right: 18px;
    bottom: 76px;
    z-index: 9999;
    max-width: 320px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    color: #0f1720;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.7;
    box-shadow: 0 16px 35px rgba(0, 0, 0, 0.18);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: 0.25s ease;
}

.push-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.push-toast-success {
    border: 1px solid rgba(25, 230, 209, 0.30);
}

.push-toast-warning {
    border: 1px solid rgba(255, 209, 102, 0.35);
}

.push-toast-error {
    border: 1px solid rgba(255, 107, 107, 0.35);
}

body.ltr .push-toast {
    right: auto;
    left: 18px;
}

/* Responsive */

@media (max-width: 992px) {
    .navbar {
        min-height: 74px;
        grid-template-columns: auto 1fr auto;
    }

    .brand {
        font-size: 22px;
    }

    .brand-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .nav-links {
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .center-nav {
        display: none;
    }

    .navbar {
        grid-template-columns: 1fr 1fr;
        direction: ltr;
    }

    html[dir="rtl"] .navbar,
    body.rtl .navbar {
        grid-template-areas: "brand actions";
    }

    html[dir="rtl"] .brand-wrap,
    body.rtl .brand-wrap {
        justify-content: flex-start;
    }

    html[dir="rtl"] .nav-actions,
    body.rtl .nav-actions {
        justify-content: flex-end;
    }

    html[dir="ltr"] .navbar,
    body.ltr .navbar {
        grid-template-areas: "actions brand";
    }

    html[dir="ltr"] .brand-wrap,
    body.ltr .brand-wrap {
        justify-content: flex-end;
    }

    html[dir="ltr"] .nav-actions,
    body.ltr .nav-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .container {
        width: min(100% - 24px, 1200px);
    }

    .nav-actions .btn-primary,
    .nav-actions .btn-dark {
        min-height: 42px;
        padding: 0 14px;
        font-size: 13px;
    }

    .icon-btn {
        width: 42px;
        height: 42px;
        border-radius: 12px;
        font-size: 18px;
    }

    .sidebar {
        width: 290px;
    }

    .push-permission-card {
        right: 12px;
        bottom: 12px;
        width: calc(100% - 24px);
        padding: 12px;
        border-radius: 18px;
        grid-template-columns: 40px 1fr;
        gap: 10px;
    }

    body.ltr .push-permission-card {
        right: auto;
        left: 12px;
    }

    .push-permission-icon {
        width: 40px;
        height: 40px;
        border-radius: 14px;
        font-size: 18px;
    }

    .push-permission-content strong {
        font-size: 13px;
    }

    .push-permission-content span {
        font-size: 11px;
    }

    .push-permission-actions {
        gap: 8px;
    }

    .push-permission-btn {
        min-height: 36px;
        padding: 0 13px;
        font-size: 11px;
    }

    .push-toast {
        right: 12px;
        left: 12px;
        bottom: 68px;
        max-width: none;
    }

    body.ltr .push-toast {
        right: 12px;
        left: 12px;
    }
}