/**
 * Brand UI overrides — Auth + CRM polish
 * Primary: #0F3D5E | Accent: #1F7A8C
 */

:root {
    --brand-ink: #0b2436;
    --brand-primary: #0f3d5e;
    --brand-accent: #1f7a8c;
    --brand-accent-hover: #196879;
    --brand-soft: #e8eef2;
    --brand-paper: #f4f7f9;
    --brand-line: rgba(15, 61, 94, 0.1);
    --brand-radius: 14px;
    --brand-shadow: 0 14px 40px rgba(11, 36, 54, 0.1);
    --brand-font: 'Plus Jakarta Sans', 'Roboto', sans-serif;
}

[dir="rtl"] {
    --brand-font: 'Cairo', 'Roboto', sans-serif;
}

/* ------------------------------------------------------------------
   Public language switcher (auth pages)
------------------------------------------------------------------- */
.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.18rem;
    border-radius: 999px;
    background: rgba(15, 61, 94, 0.06);
    border: 1px solid var(--brand-line);
}

.lang-switch-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.35rem;
    padding: 0.32rem 0.6rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #5b6b78;
    transition: background 0.2s ease, color 0.2s ease;
    text-decoration: none !important;
}

.lang-switch-link:hover {
    color: var(--brand-primary);
}

.lang-switch-link.is-active {
    background: var(--brand-primary);
    color: #fff;
}

.lang-switch-sep {
    display: none;
}

.lang-switch--on-dark {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
}

.lang-switch--on-dark .lang-switch-link {
    color: rgba(255, 255, 255, 0.75);
}

.lang-switch--on-dark .lang-switch-link:hover {
    color: #fff;
}

.lang-switch--on-dark .lang-switch-link.is-active {
    background: rgba(255, 255, 255, 0.95);
    color: var(--brand-primary);
}

/* ------------------------------------------------------------------
   Auth shell (login / signup / forgot / reset)
------------------------------------------------------------------- */
body.logged-out #main-wrapper,
body:not(.loggedin) #main-wrapper {
    min-height: 100vh;
}

body.logged-out,
html.logged-out body {
    font-family: var(--brand-font);
}

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    min-height: 100vh;
    background: var(--brand-paper);
}

.auth-panel-visual {
    position: relative;
    background:
        radial-gradient(ellipse 70% 50% at 80% 10%, rgba(31, 122, 140, 0.42), transparent 55%),
        radial-gradient(ellipse 40% 35% at 10% 90%, rgba(15, 61, 94, 0.45), transparent 50%),
        linear-gradient(150deg, #071824 0%, #0f3d5e 55%, #164e6b 100%);
    color: #fff;
    padding: 2.5rem clamp(1.5rem, 4vw, 3.25rem);
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.auth-panel-visual::before {
    content: '';
    position: absolute;
    width: 280px;
    height: 280px;
    right: -40px;
    top: 12%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(31, 122, 140, 0.4), transparent 70%);
    animation: authPulse 8s ease-in-out infinite;
}

.auth-panel-visual::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.5;
    pointer-events: none;
}

.auth-panel-visual-inner {
    position: relative;
    z-index: 1;
    max-width: 28rem;
    animation: authRise 0.65s ease both;
}

.auth-back-home-light {
    display: inline-block;
    margin-bottom: 1.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: #fff;
    letter-spacing: -0.02em;
    text-decoration: none !important;
}

.auth-visual-title {
    margin: 0 0 0.85rem;
    font-size: clamp(1.35rem, 2.4vw, 1.85rem);
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.02em;
}

.auth-visual-text {
    margin: 0 0 1.5rem;
    color: rgba(255, 255, 255, 0.72);
    font-size: 1rem;
    line-height: 1.6;
}

.auth-visual-points {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.55rem;
}

.auth-visual-points li {
    position: relative;
    padding-inline-start: 1.15rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.92rem;
    font-weight: 500;
}

.auth-visual-points li::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 0.55em;
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: var(--brand-accent);
    box-shadow: 0 0 0 3px rgba(31, 122, 140, 0.25);
}

.auth-panel-form {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    background:
        radial-gradient(ellipse 50% 40% at 100% 0%, rgba(31, 122, 140, 0.08), transparent 55%),
        var(--brand-paper);
}

.auth-form-wrap {
    width: 100%;
    max-width: 420px;
    animation: authRise 0.7s 0.05s ease both;
}

.auth-form-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.1rem;
    flex-wrap: wrap;
}

.auth-back-link {
    display: inline-block;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--brand-accent);
    text-decoration: none !important;
}

.auth-back-link:hover {
    color: var(--brand-primary);
}

.auth-logo {
    margin: 0 0 1.15rem !important;
    padding: 0 !important;
}

.auth-logo img {
    max-height: 48px;
    width: auto;
}

.auth-card.login-box,
.auth-shell .login-box {
    background: #fff;
    border: 1px solid var(--brand-line);
    border-radius: var(--brand-radius);
    box-shadow: var(--brand-shadow);
    padding: 1.85rem 1.55rem 1.55rem !important;
    margin-top: 0 !important;
}

.auth-shell .box-title {
    color: var(--brand-primary);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem !important;
}

.auth-card-sub {
    margin: 0 0 1.35rem;
    color: #6a7a88;
    font-size: 0.9rem;
}

.auth-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--brand-primary);
}

.auth-shell .form-control {
    border-radius: 10px !important;
    border-color: rgba(15, 61, 94, 0.16) !important;
    min-height: 46px;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-shell .form-control:focus {
    border-color: var(--brand-accent) !important;
    box-shadow: 0 0 0 3px rgba(31, 122, 140, 0.18);
}

.auth-row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.auth-inline-link {
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--brand-accent) !important;
    text-decoration: none !important;
}

.auth-inline-link:hover {
    color: var(--brand-primary) !important;
}

.auth-alt-action {
    color: #6a7a88;
    font-size: 0.9rem;
}

.auth-shell .auth-submit.btn-info,
.auth-shell .btn-info.btn-block {
    background: var(--brand-accent) !important;
    border-color: var(--brand-accent) !important;
    border-radius: 999px !important;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 0.8rem 1rem;
    box-shadow: 0 8px 22px rgba(31, 122, 140, 0.28);
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.auth-shell .auth-submit.btn-info:hover,
.auth-shell .btn-info.btn-block:hover {
    background: var(--brand-accent-hover) !important;
    border-color: var(--brand-accent-hover) !important;
    transform: translateY(-1px);
}

.auth-shell .text-info {
    color: var(--brand-accent) !important;
}

.auth-shell .login-background {
    display: none !important;
}

@keyframes authRise {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes authPulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.08); }
}

@media (max-width: 900px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-panel-visual {
        min-height: 200px;
        align-items: center;
        padding: 1.5rem;
    }

    .auth-visual-text,
    .auth-visual-points {
        display: none;
    }

    .auth-panel-form {
        padding: 1.5rem 1rem 2.5rem;
    }
}

/* ------------------------------------------------------------------
   CRM chrome polish
------------------------------------------------------------------- */
body.loggedin {
    background: var(--brand-paper);
}

body.loggedin .page-wrapper {
    background: var(--brand-paper);
}

body.loggedin .topbar,
body.loggedin .navbar-header {
    box-shadow: 0 1px 0 var(--brand-line);
    backdrop-filter: saturate(1.1);
}

body.loggedin .topbar .navbar-brand,
body.loggedin .topbar .nav-toggler,
body.loggedin .topbar .nav-link {
    transition: color 0.15s ease, opacity 0.15s ease;
}

body.loggedin .left-sidebar {
    border-inline-end: 1px solid var(--brand-line);
    box-shadow: 4px 0 24px rgba(11, 36, 54, 0.03);
}

body.loggedin .sidebar-nav ul li a {
    border-radius: 10px;
    margin-inline: 0.5rem;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    line-height: 1.35;
}

body.loggedin .sidebar-nav > ul > li > a i {
    width: 1.35rem;
    flex-shrink: 0;
    text-align: center;
    margin: 0 !important;
}

body.loggedin .sidebar-nav ul li a .hide-menu {
    flex: 1;
    min-width: 0;
}

body.loggedin .sidebar-nav ul li a:hover,
body.loggedin .sidebar-nav ul li.active > a {
    background: rgba(31, 122, 140, 0.1);
}

body.loggedin .card {
    border: 1px solid var(--brand-line);
    border-radius: var(--brand-radius);
    box-shadow: 0 6px 20px rgba(11, 36, 54, 0.045);
    overflow: hidden;
}

body.loggedin .card-body {
    padding: 1.2rem 1.3rem;
}

body.loggedin .card-title,
body.loggedin .card .card-header {
    color: var(--brand-primary);
    font-weight: 600;
}

body.loggedin .card-header {
    background: #fff;
    border-bottom: 1px solid var(--brand-line);
}

body.loggedin .btn-info,
body.loggedin .btn-primary,
body.loggedin .btn-secondary.btn-info {
    background-color: var(--brand-accent);
    border-color: var(--brand-accent);
}

body.loggedin .btn-info:hover,
body.loggedin .btn-info:focus,
body.loggedin .btn-primary:hover,
body.loggedin .btn-primary:focus {
    background-color: var(--brand-accent-hover);
    border-color: var(--brand-accent-hover);
}

body.loggedin .btn {
    border-radius: 9px;
    font-weight: 500;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

body.loggedin .btn:hover {
    transform: translateY(-1px);
}

body.loggedin .btn-rounded,
body.loggedin .btn.btn-rounded {
    border-radius: 999px !important;
}

body.loggedin .form-control,
body.loggedin .select2-container--default .select2-selection--single,
body.loggedin .select2-container--default .select2-selection--multiple {
    border-radius: 9px;
    border-color: rgba(15, 61, 94, 0.16);
}

body.loggedin .form-control:focus {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px rgba(31, 122, 140, 0.15);
}

body.loggedin .table {
    background: #fff;
}

body.loggedin .table thead th {
    border-bottom-width: 1px;
    color: var(--brand-primary);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.01em;
    background: rgba(232, 238, 242, 0.55);
}

body.loggedin .table-hover tbody tr:hover {
    background-color: rgba(31, 122, 140, 0.05);
}

body.loggedin .table td,
body.loggedin .table th {
    vertical-align: middle;
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
}

body.loggedin .list-pages-crumbs,
body.loggedin .page-titles {
    margin-bottom: 1.1rem;
}

body.loggedin .page-titles h3,
body.loggedin .page-titles .text-themecolor {
    color: var(--brand-primary) !important;
    font-weight: 700;
    letter-spacing: -0.02em;
}

body.loggedin .dashboard-wrapper .card,
body.loggedin [id*="dashboard"] .card,
body.loggedin .widget-card {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

body.loggedin .dashboard-wrapper .card:hover,
body.loggedin [id*="dashboard"] .card:hover {
    box-shadow: 0 12px 30px rgba(11, 36, 54, 0.09);
    transform: translateY(-2px);
}

body.loggedin .modal-content {
    border: 0;
    border-radius: var(--brand-radius);
    box-shadow: 0 22px 55px rgba(11, 36, 54, 0.2);
}

body.loggedin .modal-header {
    border-bottom-color: var(--brand-line);
}

body.loggedin .modal-footer {
    border-top-color: var(--brand-line);
}

body.loggedin a.text-info,
body.loggedin .text-info {
    color: var(--brand-accent) !important;
}

body.loggedin .list-actions-button {
    border-radius: 9px !important;
}

.preloader .loader-loading {
    border-top-color: var(--brand-accent);
}

@media (prefers-reduced-motion: reduce) {
    .auth-form-wrap,
    .auth-panel-visual-inner,
    .auth-panel-visual::before,
    body.loggedin .btn:hover,
    body.loggedin .dashboard-wrapper .card:hover {
        animation: none;
        transform: none;
    }
}

/* ------------------------------------------------------------------
   Arabic / RTL polish
------------------------------------------------------------------- */
[dir="rtl"] body.loggedin .page-titles .d-flex,
[dir="rtl"] body.loggedin .list-pages-crumbs .d-flex {
    flex-wrap: wrap;
    gap: 0.5rem;
}

[dir="rtl"] body.loggedin .btn-sm,
[dir="rtl"] body.loggedin .btn-rounded {
    white-space: normal;
    line-height: 1.35;
}

[dir="rtl"] body.loggedin .table td,
[dir="rtl"] body.loggedin .table th {
    line-height: 1.45;
}

[dir="rtl"] body.loggedin .sidebar-nav ul li a {
    line-height: 1.4;
}

[dir="rtl"] body.loggedin .card-title {
    line-height: 1.4;
}

[dir="rtl"] .auth-shell {
    direction: rtl;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
}

[dir="rtl"] .auth-panel-form {
    order: 1;
}

[dir="rtl"] .auth-panel-visual {
    order: 2;
}

[dir="rtl"] .auth-shell .box-title,
[dir="rtl"] .auth-shell label,
[dir="rtl"] .auth-label,
[dir="rtl"] .auth-form-wrap,
[dir="rtl"] .auth-card.login-box {
    text-align: right;
}

[dir="rtl"] .auth-form-top {
    flex-direction: row-reverse;
}

@media (max-width: 900px) {
    [dir="rtl"] .auth-shell {
        grid-template-columns: 1fr;
    }

    [dir="rtl"] .auth-panel-visual {
        order: 0;
    }

    [dir="rtl"] .auth-panel-form {
        order: 1;
    }
}

/* ------------------------------------------------------------------
   Dashboard widgets — modern stats + panels
------------------------------------------------------------------- */
body.loggedin .dash-stat-card {
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

body.loggedin .dash-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 32px rgba(11, 36, 54, 0.1);
}

body.loggedin .dash-stat-card .card-body {
    padding: 1.15rem 1.2rem 1.05rem;
}

body.loggedin .dash-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
}

body.loggedin .dash-stat-copy {
    min-width: 0;
    flex: 1;
}

body.loggedin .dash-stat-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #6a7a88;
    line-height: 1.35;
    letter-spacing: 0.01em;
}

body.loggedin .dash-stat-value {
    display: block;
    font-size: clamp(1.35rem, 2vw, 1.7rem);
    font-weight: 700;
    color: var(--brand-primary);
    letter-spacing: -0.03em;
    line-height: 1.2;
    word-break: break-word;
}

body.loggedin .dash-stat-icon {
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
}

body.loggedin .dash-stat-card--success .dash-stat-icon {
    background: rgba(40, 167, 69, 0.12);
    color: #28a745;
}

body.loggedin .dash-stat-card--info .dash-stat-icon {
    background: rgba(31, 122, 140, 0.12);
    color: var(--brand-accent);
}

body.loggedin .dash-stat-card--warning .dash-stat-icon {
    background: rgba(255, 193, 7, 0.16);
    color: #d39e00;
}

body.loggedin .dash-stat-card--danger .dash-stat-icon {
    background: rgba(220, 53, 69, 0.12);
    color: #dc3545;
}

body.loggedin .dash-panel .card-body {
    padding: 1.25rem 1.35rem 1.15rem;
}

body.loggedin .dash-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

body.loggedin .dash-panel-meta,
body.loggedin .dash-chart-keys {
    color: #6a7a88;
    font-size: 0.82rem;
    font-weight: 500;
}

body.loggedin .dash-lead-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem 0.45rem;
    margin-bottom: 0;
}

body.loggedin .dash-lead-legend .label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: normal;
    line-height: 1.3;
    max-width: 100%;
    padding: 0.35rem 0.7rem;
}

body.loggedin .dash-income-summary h2 {
    color: var(--brand-primary);
    font-weight: 700;
    letter-spacing: -0.02em;
}

body.loggedin .dash-income-summary small {
    color: #6a7a88;
    font-weight: 500;
}

body.loggedin .top-search-container {
    position: relative;
}

body.loggedin .top-search-container .form-control {
    border-radius: 999px;
    min-height: 38px;
    padding-inline: 1rem 2.4rem;
    background: #f3f6f8;
    border-color: transparent;
}

body.loggedin .top-search-container .form-control:focus {
    background: #fff;
    border-color: rgba(31, 122, 140, 0.35);
}

body.loggedin .dashboard-projects-admin a,
body.loggedin .dashboard-events {
    transition: background 0.15s ease;
}

body.loggedin .card-title {
    letter-spacing: -0.01em;
}

[dir="rtl"] body.loggedin .dash-stat {
    flex-direction: row;
}

[dir="rtl"] body.loggedin .dash-stat-copy,
[dir="rtl"] body.loggedin .dash-stat-label,
[dir="rtl"] body.loggedin .dash-stat-value {
    text-align: right;
}

[dir="rtl"] body.loggedin .dash-panel-head {
    flex-direction: row;
}

[dir="rtl"] body.loggedin .top-search-container .form-control {
    text-align: right;
    padding-inline: 2.4rem 1rem;
}

[dir="rtl"] body.loggedin .c3-chart-arcs-title,
[dir="rtl"] body.loggedin #leadsWidget text {
    font-family: 'Cairo', sans-serif !important;
}
