﻿:root {
    --ct-ink: #123b34;
    --ct-ink-deep: #082a25;
    --ct-green: #2e946c;
    --ct-mint: #e8f3ee;
    --ct-gold: #c79b4d;
    --ct-bg: #f5f7f6;
    --ct-surface: #ffffff;
    --ct-line: #dce7e2;
    --ct-text: #1f3934;
    --ct-muted: #6c7f7a;
    --ct-danger: #c94b4b;
    --ct-radius: 14px; /* تصغير الانحناء قليلاً ليتناسب مع الحجم المضغوط */
    --ct-shadow: 0 10px 30px -20px rgba(12, 51, 43, .45);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    font-size: 14px; /* تصغير الفونت الأساسي للصفحة لتصغير الإسكيال العام */
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ct-text);
    background: var(--ct-bg);
    direction: rtl;
    text-align: right;
    font-family: 'Cairo', Tahoma, Arial, sans-serif !important;
    overflow-x: hidden;
}

/* Main application shell */
.wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
}

.sidebar {
    width: 250px; /* تقليص عرض القائمة الجانبية */
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 1040;
    padding: 16px 10px;
    overflow-y: auto;
    color: #eff9f5;
    background: linear-gradient(165deg, #0c302a 0%, #135047 58%, #0a2d28 100%);
    box-shadow: -10px 0 25px -20px rgba(4, 37, 30, .9);
    transition: width .2s ease, right .2s ease;
}

.sidebar-header {
    padding: 8px 10px 18px;
    border-bottom: 1px solid rgba(232, 243, 238, .13);
    margin-bottom: 10px;
}

    .sidebar-header h4 {
        display: flex;
        align-items: center;
        gap: 8px;
        margin: 0;
        color: #fff;
        font-size: 1.1rem;
        font-weight: 800;
    }

        .sidebar-header h4 i {
            display: grid;
            place-items: center;
            width: 27px;
            height: 27px;
            border-radius: 8px;
            background: var(--ct-gold);
            color: #183831 !important;
            font-size: .85rem;
        }

    .sidebar-header span {
        display: block;
        margin: 6px 35px 0 0;
        color: #abd3c7;
        font-size: .68rem;
        font-weight: 600;
    }

.sidebar-menu {
    padding: 0;
    margin: 0;
    list-style: none;
}

    .sidebar-menu li {
        margin: 3px 0;
    }

    .sidebar-menu .sidebar-label {
        margin: 18px 10px 5px;
        color: #78aa9c;
        font-size: .6rem;
        font-weight: 900;
        letter-spacing: .075em;
    }

        .sidebar-menu .sidebar-label:first-child {
            margin-top: 6px;
        }

    .sidebar-menu li a {
        display: flex;
        align-items: center;
        gap: 10px;
        min-height: 38px; /* تصغير الارتفاع */
        padding: 8px 11px;
        border: 1px solid transparent;
        border-radius: 10px;
        color: #c4ddd5;
        text-decoration: none;
        font-size: .83rem;
        font-weight: 700;
        transition: background-color .15s ease, color .15s ease;
    }

        .sidebar-menu li a i {
            width: 18px;
            text-align: center;
            color: #80b7a7;
            font-size: .9rem;
        }

        .sidebar-menu li a:hover, .sidebar-menu li.active a {
            color: #fff;
            background: rgba(255,255,255,.10);
            border-color: rgba(255,255,255,.08);
        }

            .sidebar-menu li a:hover i, .sidebar-menu li.active a i {
                color: #e8c276;
            }

.main-content {
    width: calc(100% - 250px);
    min-width: 0;
    min-height: 100vh;
    margin-right: 250px;
    transition: margin-right .2s ease, width .2s ease;
}

.top-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    min-height: 62px; /* تصغير شريط التنقل العلوي */
    padding: 0 24px;
    background: rgba(255,255,255,.94);
    border-bottom: 1px solid rgba(220,231,226,.9);
    box-shadow: 0 4px 15px -15px rgba(17,58,51,.5);
    backdrop-filter: blur(10px);
}

.page-title h5 {
    color: var(--ct-ink) !important;
    font-size: .9rem;
    font-weight: 800 !important;
}

.toggle-sidebar-btn {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--ct-line);
    border-radius: 9px;
    background: var(--ct-surface);
    color: var(--ct-ink);
    cursor: pointer;
}

    .toggle-sidebar-btn:hover {
        border-color: var(--ct-green);
    }

.user-profile {
    color: var(--ct-ink);
    font-size: .79rem;
    font-weight: 700;
}

    .user-profile > i {
        color: var(--ct-green) !important;
    }

    .user-profile .btn {
        border-radius: 8px;
        border-color: var(--ct-line);
        color: var(--ct-text);
        font-weight: 700;
        padding: 0.3rem 0.6rem;
        font-size: 0.78rem;
    }

        .user-profile .btn:hover {
            color: #fff;
            background: var(--ct-ink);
            border-color: var(--ct-ink);
        }

.notifications-dropdown > a {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: #f0f6f3;
    color: var(--ct-ink) !important;
}

.notification-badge {
    top: 2px !important;
    left: 2px !important;
    min-width: 16px;
    font-size: .55rem !important;
}

.notifications-dropdown .dropdown-menu {
    right: auto !important;
    left: 0 !important;
    width: min(320px, calc(100vw - 24px)) !important;
    border: 1px solid var(--ct-line) !important;
    border-radius: 12px !important;
    box-shadow: var(--ct-shadow) !important;
}

.page-body {
    padding: 20px 24px; /* تقليص الحواشي العامة للصفحة */
}

.card-box {
    margin-bottom: 15px;
}

.page-body > .card-box {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.page-body .bg-white, .card-box, .p-4.bg-white {
    border-color: var(--ct-line) !important;
    border-radius: var(--ct-radius) !important;
    box-shadow: var(--ct-shadow) !important;
    padding: 1.25rem !important; /* تصغير الفراغات الداخلية للبطاقات */
}

.page-body h3 {
    color: var(--ct-ink) !important;
    font-size: 1.4rem;
}

.page-body h5, .page-body h6 {
    color: var(--ct-ink);
}

.page-body .text-muted {
    color: var(--ct-muted) !important;
}

/* Forms and actions */
.form-label, .form-group label {
    color: var(--ct-text) !important;
    font-weight: 800 !important;
    font-size: .78rem;
    margin-bottom: 4px;
}

.form-control, .form-select {
    min-height: 38px; /* تقليص ارتفاع الحقول */
    border: 1px solid var(--ct-line) !important;
    border-radius: 9px !important;
    padding: 6px 11px !important;
    color: var(--ct-text) !important;
    direction: rtl;
    text-align: right;
    font-family: inherit !important;
    font-size: .83rem;
    box-shadow: none !important;
}

textarea.form-control {
    min-height: 80px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--ct-green) !important;
    box-shadow: 0 0 0 3px rgba(46,148,108,.1) !important;
}

select.form-control, select.form-select {
    background-position: left .75rem center !important;
    padding-left: 2rem !important;
}

.btn {
    border-radius: 8px;
    font-weight: 800;
    padding: 0.42rem 0.9rem;
    font-size: 0.83rem;
    transition: transform .15s ease, box-shadow .15s ease;
}

    .btn:active {
        transform: scale(.98);
    }

.btn-primary {
    background: var(--ct-ink);
    border-color: var(--ct-ink);
}

    .btn-primary:hover, .btn-primary:focus {
        background: #0a2f29;
        border-color: #0a2f29;
    }

.btn-success {
    background: var(--ct-green);
    border-color: var(--ct-green);
}

.btn-light {
    background: #fff;
}

.badge {
    border-radius: 6px;
    font-weight: 800;
    font-size: 0.75rem;
}

/* Tables, metrics and charts */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--ct-line);
    border-radius: 11px;
}

.table {
    margin: 0;
    background: var(--ct-surface);
    color: var(--ct-text);
    font-size: 0.85rem;
}

    .table thead {
        background: #eef5f2;
        color: var(--ct-ink);
        font-size: 0.8rem;
    }

    .table > :not(caption) > * > * {
        padding: 0.55rem 0.75rem; /* تصغير الفراغات داخل خلايا الجداول */
        border-color: #e8efec;
        vertical-align: middle;
    }

.progress {
    overflow: hidden;
    background: #e8f0ed;
    border-radius: 99px;
    height: 5px !important;
}

.progress-bar {
    border-radius: 99px;
}

footer {
    margin-top: 20px;
    padding: 15px 24px;
    color: var(--ct-muted);
    font-size: .74rem;
    background: transparent;
    border-top: 1px solid var(--ct-line);
}

/* Authentication screens */
.ct-login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    background: radial-gradient(circle at 83% 14%, rgba(199,155,77,.2), transparent 27%), radial-gradient(circle at 14% 82%, rgba(93,181,145,.15), transparent 29%), linear-gradient(135deg, #082c27 0%, #10483f 52%, #0b302a 100%);
}

.ct-login-card {
    position: relative;
    width: 100%;
    max-width: 440px;
    padding: 32px;
    border: 1px solid rgba(255,255,255,.7);
    border-radius: 20px;
    background: rgba(255,255,255,.98);
    box-shadow: 0 20px 50px -25px rgba(0,0,0,.6);
}

.ct-login-mark {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    border-radius: 14px;
    background: linear-gradient(145deg, #d7af63, #b8873f);
    color: #143b34;
    font-size: .85rem;
    font-weight: 900;
}

.ct-login-toolbar {
    display: flex;
    justify-content: flex-start;
    min-height: 28px;
    margin-bottom: 2px;
}

.ct-language-switch {
    font-size: .7rem;
    font-weight: 800;
}

.ct-login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    margin: 0 0 6px;
    padding: 6px 10px 2px;
}

.ct-login-logo {
    display: block;
    width: min(100%, 230px);
    max-width: 230px;
    height: auto;
    max-height: 90px;
    object-fit: contain;
    object-position: center;
}

.ct-kicker {
    margin: 0 0 4px;
    color: #a47832;
    font-size: .7rem;
    font-weight: 900;
    letter-spacing: .04em;
}

.ct-login-card h1 {
    margin-bottom: 8px;
    color: var(--ct-ink);
    font-size: 1.45rem;
    font-weight: 900;
}

.ct-login-card .text-muted {
    color: var(--ct-muted) !important;
    line-height: 1.7;
    font-size: 0.85rem;
}

.ct-login-card .btn-primary {
    min-height: 42px;
}

/* Collapsed / responsive navigation */
.wrapper.sidebar-collapsed .sidebar {
    width: 70px;
}

.wrapper.sidebar-collapsed .main-content {
    width: calc(100% - 70px);
    margin-right: 70px;
}

.wrapper.sidebar-collapsed .sidebar-header {
    padding-right: 8px;
    padding-left: 8px;
    text-align: center;
}

    .wrapper.sidebar-collapsed .sidebar-header h4, .wrapper.sidebar-collapsed .sidebar-header span, .wrapper.sidebar-collapsed .sidebar-menu span {
        display: none;
    }

.wrapper.sidebar-collapsed .sidebar-menu a {
    justify-content: center;
    padding: 9px;
}

    .wrapper.sidebar-collapsed .sidebar-menu a i {
        width: auto;
        margin: 0;
    }

.wrapper.sidebar-collapsed .sidebar-menu .sidebar-label {
    display: none;
}

@media (max-width: 992px) {
    .sidebar {
        right: -260px;
        width: 250px;
    }

    .wrapper.mobile-sidebar-open .sidebar {
        right: 0;
    }

    .main-content, .wrapper.sidebar-collapsed .main-content {
        width: 100%;
        margin-right: 0;
    }

    .page-body {
        padding: 18px 14px;
    }

    .top-navbar {
        min-height: 58px;
        padding: 0 14px;
    }
}

@media (max-width: 576px) {
    .page-title {
        display: none;
    }

    .top-navbar {
        gap: 6px;
    }

    .notifications-dropdown .dropdown-menu {
        position: fixed !important;
        top: 52px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
    }

    .page-body {
        padding: 12px 10px;
    }

    .ct-login-body {
        padding: 12px;
    }

    .ct-login-card {
        padding: 24px 18px;
        border-radius: 16px;
    }

    footer {
        padding: 12px 10px;
    }
}

/* English localization */
html[dir="ltr"] body {
    direction: ltr;
    text-align: left;
}

html[dir="ltr"] .sidebar {
    inset: 0 auto 0 0;
    box-shadow: 10px 0 25px -20px rgba(4, 37, 30, .9);
}

html[dir="ltr"] .sidebar-header span {
    margin: 6px 0 0 35px;
}

html[dir="ltr"] .main-content {
    margin-right: 0;
    margin-left: 250px;
}

html[dir="ltr"] .wrapper.sidebar-collapsed .main-content {
    margin-right: 0;
    margin-left: 70px;
}

html[dir="ltr"] .form-control, html[dir="ltr"] .form-select {
    direction: ltr;
    text-align: left;
}

html[dir="ltr"] select.form-control, select.form-select {
    background-position: right .75rem center !important;
    padding-right: 2rem !important;
    padding-left: 11px !important;
}

html[dir="ltr"] .notification-badge {
    left: auto !important;
    right: 2px !important;
}

html[dir="ltr"] .notifications-dropdown .dropdown-menu {
    right: 0 !important;
    left: auto !important;
}

@media (max-width: 992px) {
    html[dir="ltr"] .sidebar {
        right: auto;
        left: -260px;
    }

    html[dir="ltr"] .wrapper.mobile-sidebar-open .sidebar {
        left: 0;
    }
}
