:root {
    --primary-black: #0D0D0D;
    --secondary-black: #171717;
    --soft-black: #222222;
    --primary-gold: #D4AF37;
    --dark-gold: #B08D2F;
    --light-gold: #F3D675;
    --white: #FFFFFF;
    --off-white: #F8F8F8;
    --light-gray: #E6E6E6;
    --muted: #6B7280;
    --text: #1F2937;
    --success: #15803D;
    --warning: #B45309;
    --danger: #B91C1C;
    --info: #2563EB;
    --sidebar-width: 290px;
    --radius-lg: 22px;
    --radius-md: 14px;
    --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.12);
    --shadow-gold: 0 12px 35px rgba(212, 175, 55, 0.20);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Cairo", Arial, sans-serif;
    direction: rtl;
    background:
        radial-gradient(circle at top left, rgba(212, 175, 55, 0.16), transparent 35%),
        linear-gradient(135deg, #fafafa 0%, #f3f4f6 55%, #ffffff 100%);
    color: var(--text);
    min-height: 100vh;
}

a {
    text-decoration: none;
}

img {
    max-width: 100%;
}

/* Loader */
.page-loader {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at center, rgba(212, 175, 55, 0.15), transparent 35%),
        linear-gradient(135deg, #050505, #171717);
    z-index: 99999;
    display: grid;
    place-items: center;
    transition: opacity 0.45s ease, visibility 0.45s ease;
}

.page-loader.hide {
    opacity: 0;
    visibility: hidden;
}

.loader-card {
    width: min(90%, 390px);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 28px;
    padding: 34px 28px;
    text-align: center;
    color: white;
    backdrop-filter: blur(14px);
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.35);
    animation: loaderPop 0.8s ease both;
}

.loader-logo {
    width: 92px;
    height: 92px;
    object-fit: cover;
    border-radius: 22px;
    border: 2px solid var(--primary-gold);
    background: white;
    padding: 4px;
    animation: logoPulse 1.6s infinite ease-in-out;
}

.loader-card h2 {
    margin: 18px 0 6px;
    color: var(--primary-gold);
    font-size: 22px;
}

.loader-card p {
    margin: 0 0 18px;
    color: #e5e7eb;
}

.loader-line {
    height: 7px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    overflow: hidden;
}

.loader-line span {
    display: block;
    height: 100%;
    width: 45%;
    background: linear-gradient(90deg, transparent, var(--primary-gold), transparent);
    animation: loadingMove 1.2s infinite ease-in-out;
}

@keyframes loaderPop {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes logoPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(212, 175, 55, 0);
    }
    50% {
        transform: scale(1.06);
        box-shadow: 0 0 35px rgba(212, 175, 55, 0.45);
    }
}

@keyframes loadingMove {
    from {
        transform: translateX(140%);
    }
    to {
        transform: translateX(-240%);
    }
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background:
        linear-gradient(180deg, #080808 0%, #161616 60%, #0f0f0f 100%);
    color: white;
    z-index: 1000;
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(212, 175, 55, 0.22);
    box-shadow: -12px 0 35px rgba(0, 0, 0, 0.22);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand img {
    width: 62px;
    height: 62px;
    object-fit: cover;
    border-radius: 16px;
    border: 1px solid var(--primary-gold);
    background: white;
    padding: 3px;
}

.sidebar-brand h1 {
    margin: 0;
    font-size: 21px;
    color: var(--primary-gold);
    line-height: 1.2;
}

.sidebar-brand p {
    margin: 3px 0 0;
    font-size: 13px;
    color: #e5e7eb;
}

.sidebar-nav {
    padding: 18px 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
    overflow-y: auto;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    color: #f3f4f6;
    padding: 12px 14px;
    border-radius: 16px;
    transition: 0.25s ease;
    position: relative;
    overflow: hidden;
}

.sidebar-nav a::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.16), transparent);
    opacity: 0;
    transition: 0.25s ease;
}

.sidebar-nav a:hover {
    color: var(--primary-gold);
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(-4px);
}

.sidebar-nav a:hover::before {
    opacity: 1;
}

.nav-icon {
    width: 26px;
    text-align: center;
    font-size: 17px;
    z-index: 1;
}

.sidebar-nav a span:last-child {
    z-index: 1;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.10);
    margin: 8px 6px;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-mini-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(212, 175, 55, 0.18);
    padding: 10px;
    border-radius: 16px;
    margin-bottom: 10px;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--primary-gold);
    color: var(--primary-black);
    font-weight: 900;
    text-transform: uppercase;
}

.user-mini-card strong {
    display: block;
    font-size: 13px;
    color: white;
}

.user-mini-card span {
    font-size: 12px;
    color: #d1d5db;
}

.sidebar-logout,
.sidebar-login,
.sidebar-register {
    width: 100%;
    display: block;
    text-align: center;
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 11px 14px;
    border-radius: 14px;
    transition: 0.25s ease;
}

.sidebar-logout {
    background: rgba(185, 28, 28, 0.18);
    color: #fecaca;
}

.sidebar-logout:hover {
    background: rgba(185, 28, 28, 0.36);
}

.sidebar-login {
    background: var(--primary-gold);
    color: var(--primary-black);
    font-weight: 800;
    margin-bottom: 8px;
}

.sidebar-register {
    border: 1px solid rgba(212, 175, 55, 0.45);
    color: var(--primary-gold);
}

.sidebar-login:hover,
.sidebar-register:hover {
    transform: translateY(-2px);
}

/* Overlay */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.48);
    z-index: 900;
    opacity: 0;
    pointer-events: none;
    transition: 0.25s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

/* Layout */
.app-shell {
    margin-right: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 800;
    min-height: 78px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(17, 17, 17, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
}

.sidebar-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    background: var(--primary-black);
    color: var(--primary-gold);
    font-size: 22px;
}

.topbar-title h2 {
    margin: 0;
    color: var(--primary-black);
    font-size: 22px;
}

.topbar-title p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-btn {
    background: var(--primary-black);
    color: var(--primary-gold);
    padding: 10px 17px;
    border-radius: 999px;
    font-weight: 700;
    transition: 0.25s ease;
}

.topbar-btn:hover {
    background: var(--primary-gold);
    color: var(--primary-black);
    transform: translateY(-2px);
}

.main-content {
    flex: 1;
    padding: 26px;
}

.container {
    width: min(1180px, 100%);
    margin: 0 auto;
}

/* Messages */
.messages-wrapper {
    width: min(1180px, calc(100% - 52px));
    margin: 20px auto 0;
}

.message {
    padding: 14px 18px;
    border-radius: 16px;
    margin-bottom: 10px;
    font-weight: 700;
    animation: slideDown 0.45s ease both;
}

.message.success {
    background: #DCFCE7;
    color: #166534;
}

.message.error {
    background: #FEE2E2;
    color: #991B1B;
}

.message.warning {
    background: #FEF3C7;
    color: #92400E;
}

.message.info {
    background: #DBEAFE;
    color: #1E40AF;
}

/* General Sections */
.section {
    padding: 28px 0;
}

.section-title {
    font-size: clamp(26px, 3vw, 40px);
    margin: 0;
    color: var(--primary-black);
    font-weight: 900;
}

.section-subtitle {
    color: var(--muted);
    line-height: 1.9;
    max-width: 850px;
}

.gold-line {
    width: 78px;
    height: 5px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary-gold), var(--dark-gold));
    margin: 14px 0 22px;
}

/* Hero */
.hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at top left, rgba(212, 175, 55, 0.24), transparent 40%),
        linear-gradient(135deg, var(--primary-black), var(--soft-black));
    color: white;
    border-radius: 32px;
    padding: 62px 42px;
    box-shadow: var(--shadow-soft);
    min-height: 420px;
    display: flex;
    align-items: center;
}

.hero::before {
    content: "";
    position: absolute;
    width: 280px;
    height: 280px;
    background: rgba(212, 175, 55, 0.13);
    border-radius: 50%;
    left: -80px;
    top: -60px;
    animation: floatShape 7s infinite ease-in-out;
}

.hero::after {
    content: "";
    position: absolute;
    width: 180px;
    height: 180px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    right: 65%;
    bottom: -60px;
    animation: floatShape 9s infinite ease-in-out reverse;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 760px;
}

.hero h1 {
    font-size: clamp(34px, 5vw, 62px);
    line-height: 1.25;
    margin: 0 0 18px;
    color: var(--primary-gold);
    font-weight: 900;
}

.hero p {
    color: #f3f4f6;
    font-size: 18px;
    line-height: 2;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 26px;
}

/* Cards */
.dashboard-grid,
.cards-grid {
    display: grid;
    gap: 18px;
}

.dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.cards-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.card,
.form-card {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(17, 17, 17, 0.08);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(10px);
    transition: 0.28s ease;
    animation: fadeUp 0.55s ease both;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.16);
}

.card h3 {
    margin-top: 0;
    color: var(--primary-black);
    font-size: 22px;
}

.card p {
    color: #374151;
    line-height: 1.85;
}

.card a:not(.btn) {
    color: var(--dark-gold);
    font-weight: 800;
}

/* Buttons */
.btn,
button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 12px 20px;
    border-radius: 999px;
    font-weight: 800;
    transition: 0.25s ease;
}

.btn-gold {
    background: linear-gradient(135deg, var(--primary-gold), var(--dark-gold));
    color: var(--primary-black);
    box-shadow: var(--shadow-gold);
}

.btn-gold:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 42px rgba(212, 175, 55, 0.32);
}

.btn-outline {
    background: transparent;
    color: var(--primary-black);
    border: 1px solid rgba(17, 17, 17, 0.18);
}

.btn-outline:hover {
    background: var(--primary-black);
    color: var(--primary-gold);
    transform: translateY(-3px);
}

/* Forms */
.form-card {
    max-width: 820px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--primary-black);
    font-weight: 800;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    font-family: inherit;
    padding: 13px 15px;
    border: 1px solid #d1d5db;
    border-radius: 14px;
    outline: none;
    transition: 0.22s ease;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.16);
}

.errorlist {
    color: var(--danger);
    margin: 8px 0 0;
    padding-right: 18px;
}

/* Status */
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 13px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 13px;
}

.status-draft {
    background: #E5E7EB;
    color: #374151;
}

.status-submitted,
.status-under_review,
.status-missing_documents {
    background: #FEF3C7;
    color: #92400E;
}

.status-accepted {
    background: #DCFCE7;
    color: #166534;
}

.status-rejected,
.status-cancelled {
    background: #FEE2E2;
    color: #991B1B;
}

/* Timeline */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.timeline-item {
    border-right: 4px solid var(--primary-gold);
    padding: 12px 16px;
    background: #fafafa;
    border-radius: 14px;
}

/* Footer */
.site-footer {
    margin: 20px 26px 26px;
    padding: 20px 24px;
    border-radius: 22px;
    background: var(--primary-black);
    color: white;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.site-footer strong {
    color: var(--primary-gold);
}

.site-footer p {
    margin: 4px 0 0;
    color: #e5e7eb;
}

/* Animations */
.page-enter {
    animation: fadeUp 0.55s ease both;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes floatShape {
    0%, 100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(-20px, 18px);
    }
}

/* Mobile */
@media (max-width: 980px) {
    .sidebar {
        transform: translateX(105%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .app-shell {
        margin-right: 0;
    }

    .sidebar-toggle {
        display: inline-grid;
        place-items: center;
    }

    .topbar {
        padding: 12px 16px;
    }

    .topbar-title h2 {
        font-size: 17px;
    }

    .topbar-title p {
        display: none;
    }

    .topbar-actions {
        display: none;
    }

    .main-content {
        padding: 18px;
    }

    .hero {
        padding: 42px 24px;
        border-radius: 24px;
    }

    .site-footer {
        margin: 16px;
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 560px) {
    .dashboard-grid,
    .cards-grid {
        grid-template-columns: 1fr;
    }

    .card,
    .form-card {
        padding: 19px;
    }

    .section-title {
        font-size: 26px;
    }

    .hero h1 {
        font-size: 34px;
    }

    .hero p {
        font-size: 15px;
    }
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    align-items: center;
    gap: 40px;
}

.hero-content h1 {
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1.4;
    margin-bottom: 16px;
}

.hero-content p {
    font-size: 1.25rem;
    line-height: 1.8;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.hero-logo-wrap {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.hero-main-logo {
    width: min(360px, 100%);
    height: auto;
    object-fit: contain;
    border: none;
    box-shadow: none;
    background: transparent;
}

.center-actions {
    display: flex;
    justify-content: center;
    margin-top: 28px;
}

@media (max-width: 900px) {
    .hero-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-logo-wrap {
        justify-content: center;
        order: -1;
    }

    .hero-main-logo {
        width: min(260px, 80%);
    }

    .hero-actions {
        justify-content: center;
    }
}

.footer-address {
    max-width: 420px;
}

.footer-address strong {
    color: var(--primary-gold);
    display: block;
    margin-bottom: 6px;
}

.footer-address p {
    margin: 0;
    line-height: 1.8;
    color: #e5e7eb;
    font-size: 14px;
}

.notification-unread {
    border: 1px solid rgba(212, 175, 55, 0.55);
    box-shadow: 0 18px 45px rgba(212, 175, 55, 0.14);
    position: relative;
}

.notification-unread::before {
    content: "جديد";
    position: absolute;
    top: 14px;
    left: 14px;
    background: #D4AF37;
    color: #111111;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}
/* ===== Final public layout cleanup ===== */
.sidebar {
    overflow-y: auto;
}

.sidebar-nav {
    min-height: 0;
    flex: 1;
}

.app-shell {
    margin-right: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
}

.main-content {
    width: 100%;
    overflow-x: hidden;
}

.topbar-actions a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.site-footer {
    margin-top: auto;
}

@media (max-width: 980px) {
    .sidebar {
        transform: translateX(110%);
        transition: transform .25s ease;
    }

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

    .app-shell {
        margin-right: 0;
        width: 100%;
    }

    .sidebar-toggle {
        display: grid;
        place-items: center;
        flex-shrink: 0;
    }

    .topbar {
        padding: 12px 16px;
        gap: 12px;
    }

    .topbar-title h2 {
        font-size: 17px;
    }

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

    .topbar-actions {
        gap: 6px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .topbar-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .main-content {
        padding: 14px;
    }
}

@media (max-width: 620px) {
    .topbar {
        align-items: flex-start;
    }

    .topbar-title {
        flex: 1;
    }

    .topbar-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .site-footer {
        padding: 20px 16px;
    }
}

/* ===== Batch 5 mobile usability cleanup ===== */
@media (max-width: 620px) {
    .main-content table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        max-width: 100%;
        font-size: 16px;
    }

    .btn,
    button.btn,
    .topbar-btn,
    .sidebar-login,
    .sidebar-register,
    .sidebar-logout {
        min-height: 44px;
        max-width: 100%;
    }

    .card,
    .form-card {
        max-width: 100%;
        overflow-wrap: anywhere;
    }

    .main-content {
        min-width: 0;
    }
}
