/* ═══════════════════════════════════════════════
   Faunex — Apple / iOS Liquid Glass Design System
   Shared across all pages
   ═══════════════════════════════════════════════ */

/* ── iOS Variables ── */
:root {
    --ios-radius-sm: 10px;
    --ios-radius-md: 14px;
    --ios-radius-lg: 22px;
    --ios-radius-xl: 26px;
    --ios-radius-pill: 999px;
    --ios-shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.04);
    --ios-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --ios-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --ios-shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.10);
    --ios-blur: blur(24px);
    --ios-blur-heavy: blur(32px);
    /* فواصل أوضح على الكروت الفاتحة في الوضع الفاتح */
    --ios-separator: rgba(60, 60, 67, 0.18);
    --ios-transition: 0.22s cubic-bezier(.4, 0, .2, 1);
}

body.dark-mode {
    --ios-separator: rgba(255, 255, 255, 0.1);
    --ios-shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.2);
    --ios-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --ios-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --ios-shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);
}

/* ── Layout ── */
.main-content,
.container {
    margin-right: 0 !important;
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 1.5rem 2rem !important;
    box-sizing: border-box !important;
}

.container {
    max-width: 1400px !important;
    margin: 0 auto !important;
}

/* ── Body ── */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: #f2f2f7 !important;
    background-image: none !important;
    min-height: 100vh;
}

body::before {
    display: none !important;
}

body.dark-mode {
    background-color: #1c1c1e !important;
    background-image: none !important;
}

/* ── Cards ── */
.card,
.d-card,
.stat-card,
.fin-stat-card,
.inventory-card,
.client-card,
.exam-card,
.apt-card,
.appointment-card,
.apt-section-card,
.section-card,
.section {
    background: var(--card-bg, #ffffff) !important;
    border-radius: var(--ios-radius-lg) !important;
    box-shadow: var(--ios-shadow-sm) !important;
    border: 1px solid var(--border-color, rgba(0,0,0,0.06)) !important;
    transition: box-shadow var(--ios-transition), transform var(--ios-transition) !important;
}

a.d-card.clickable {
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
    pointer-events: auto !important;
    text-decoration: none !important;
    color: inherit !important;
}

body.dark-mode .card,
body.dark-mode .d-card,
body.dark-mode .stat-card,
body.dark-mode .fin-stat-card,
body.dark-mode .inventory-card,
body.dark-mode .client-card,
body.dark-mode .exam-card,
body.dark-mode .apt-card,
body.dark-mode .appointment-card,
body.dark-mode .apt-section-card,
body.dark-mode .section-card,
body.dark-mode .section {
    background: var(--card-bg, #2c2c2e) !important;
    border: 1px solid var(--border-color, rgba(255,255,255,0.08)) !important;
}

.card:hover,
.d-card:hover,
.stat-card:hover,
.fin-stat-card:hover,
.inventory-card:hover,
.client-card:hover,
.exam-card:hover,
.apt-card:hover,
.appointment-card:hover,
.apt-section-card:hover,
.section-card:hover {
    box-shadow: var(--ios-shadow-md) !important;
    transform: translateY(-1px) !important;
}

/* ── Card header ── */
.card-header {
    padding: 1.1rem 1.4rem !important;
    border-bottom: 1px solid var(--ios-separator) !important;
    background: transparent !important;
    margin-bottom: 0 !important;
    gap: 0.75rem !important;
}

.card-body {
    padding: 0 !important;
}

.card-title {
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    letter-spacing: -0.01em !important;
}

/* ── Top bar ── */
.top-bar {
    padding: 1rem 0 1.25rem !important;
    border-bottom: none !important;
}

.top-bar-title {
    font-size: 1.65rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.025em !important;
    color: var(--text-primary) !important;
}

/* ── Tables ── */
table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    width: 100%;
}

table thead th {
    background: var(--bg-primary) !important;
    color: var(--text-secondary) !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
    padding: 0.7rem 1rem !important;
    border-bottom: 1px solid var(--ios-separator) !important;
    white-space: nowrap;
}

table tbody tr {
    transition: background 0.15s ease;
}

table tbody tr:hover {
    background: rgba(var(--primary-rgb, 57, 208, 227), 0.04) !important;
}

table tbody td {
    padding: 0.85rem 1rem !important;
    border-bottom: 1px solid var(--ios-separator) !important;
    font-size: 0.9rem !important;
    vertical-align: middle !important;
    color: var(--text-primary) !important;
}

table tbody tr:last-child td {
    border-bottom: none !important;
}

/* ── Inputs ── */
.form-input,
.form-select,
.form-textarea,
input.form-input,
select.form-select {
    border-radius: var(--ios-radius-md) !important;
    border: 1.5px solid var(--border-color) !important;
    background: rgba(255, 255, 255, 0.85) !important;
    font-size: 0.95rem !important;
    font-family: 'Almarai', sans-serif !important;
    padding: 0.75rem 0.95rem !important;
    transition: border-color 0.18s ease, box-shadow 0.18s ease !important;
    box-shadow: none !important;
}

input,
select,
textarea,
button {
    font-family: 'Almarai', sans-serif !important;
}

body.dark-mode .form-input,
body.dark-mode .form-select,
body.dark-mode .form-textarea,
body.dark-mode input.form-input,
body.dark-mode select.form-select {
    background: rgba(44, 44, 46, 0.85) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #f0f0f0 !important;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary) !important;
    background: #ffffff !important;
    outline: none !important;
}

body.dark-mode .form-input:focus,
body.dark-mode .form-select:focus,
body.dark-mode .form-textarea:focus {
    background: rgba(58, 58, 60, 0.95) !important;
}

/* ── Buttons ── */
.submit-button,
.btn-primary,
.btn-save {
    border-radius: var(--ios-radius-pill) !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em !important;
    box-shadow: none !important;
    padding: 0.85rem 1.6rem !important;
    transition: opacity 0.15s ease, transform 0.15s ease !important;
}

.submit-button:hover,
.btn-primary:hover,
.btn-save:hover {
    opacity: 0.88 !important;
}

.submit-button:active,
.btn-primary:active,
.btn-save:active {
    transform: scale(0.97) !important;
}

/* ── Modals ── */
.modal-content {
    border-radius: var(--ios-radius-xl) !important;
    box-shadow: var(--ios-shadow-lg) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    padding: 1.6rem !important;
    background: rgba(255, 255, 255, 0.82) !important;
    backdrop-filter: var(--ios-blur-heavy) saturate(200%) !important;
    -webkit-backdrop-filter: var(--ios-blur-heavy) saturate(200%) !important;
}

body.dark-mode .modal-content {
    background: rgba(44, 44, 46, 0.88) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.modal-header {
    border-bottom: 1px solid var(--ios-separator) !important;
    padding-bottom: 1rem !important;
    margin-bottom: 1.25rem !important;
}

.modal-title {
    font-size: 1.3rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
}

/* ── Action buttons ── */
.action-btn-edit,
.action-btn-delete {
    padding: 0.35rem 0.75rem !important;
    border-radius: var(--ios-radius-pill) !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    cursor: pointer;
    font-family: var(--font-primary, 'Almarai', sans-serif);
    border: 1px solid transparent;
    transition: all 0.15s ease !important;
    margin-right: 0.35rem;
}

.action-btn-edit {
    background: rgba(var(--primary-rgb, 57, 208, 227), 0.12);
    color: var(--primary);
    border-color: rgba(var(--primary-rgb, 57, 208, 227), 0.3);
}

body.dark-mode .action-btn-edit {
    color: var(--primary);
    border-color: rgba(var(--primary-rgb, 57, 208, 227), 0.4);
}

.action-btn-edit:hover {
    background: rgba(var(--primary-rgb, 57, 208, 227), 0.2);
    border-color: var(--primary);
}

.action-btn-delete {
    background: rgba(231, 76, 60, 0.08);
    color: var(--danger, #e74c3c);
    border-color: rgba(231, 76, 60, 0.2);
}

.action-btn-delete:hover {
    background: rgba(231, 76, 60, 0.15);
    border-color: var(--danger, #e74c3c);
}

/* ── Theme toggle ── */
.theme-toggle {
    border-radius: var(--ios-radius-md) !important;
    background: var(--bg-soft) !important;
    border: 1.5px solid var(--border-color) !important;
    width: 44px !important;
    height: 44px !important;
    box-shadow: none !important;
}

.theme-toggle:hover {
    background: var(--primary) !important;
    color: #fff !important;
    border-color: var(--primary) !important;
}

/* ── Pagination ── */
.hp-pag-btn {
    border-radius: var(--ios-radius-sm) !important;
    font-weight: 700 !important;
    width: 34px !important;
    height: 34px !important;
}

.hp-pag-btn.hp-pag-active {
    background: var(--primary) !important;
    color: #fff !important;
}

/* ── Container ── */
.container {
    padding: 1.2rem 1.5rem !important;
    max-width: 1100px !important;
}

/* ── Mobile ── */
html {
    overflow-x: hidden;
    max-width: 100vw;
}

@media (max-width: 768px) {

    html,
    body {
        overflow-y: auto !important;
        height: auto !important;
        min-height: 100vh !important;
        -webkit-overflow-scrolling: touch;
    }

    .main-content {
        overflow-y: auto !important;
        height: auto !important;
        min-height: 100vh !important;
    }

    .dashboard-grid {
        height: auto !important;
        max-height: none !important;
    }

    .d-card {
        min-height: auto !important;
        height: auto !important;
    }

    .container {
        padding: 0.75rem 1rem !important;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.5rem 0.75rem !important;
    }

    .top-bar-title {
        font-size: 1.1rem !important;
    }

    .card,
    .d-card,
    .stat-card {
        border-radius: 12px !important;
    }

    table tbody td {
        padding: 0.6rem 0.5rem !important;
        font-size: 0.8rem !important;
    }

    table thead th {
        padding: 0.5rem 0.5rem !important;
        font-size: 0.65rem !important;
    }
}

@media (max-width: 360px) {
    .container {
        padding: 0.4rem 0.5rem !important;
    }

    .top-bar-title {
        font-size: 1rem !important;
    }

    .card,
    .d-card,
    .stat-card {
        border-radius: 10px !important;
    }

    .submit-button,
    .btn-primary,
    .btn-save {
        padding: 0.7rem 1.2rem !important;
        font-size: 0.9rem !important;
    }
}

@media (max-width: 900px) {
    .main-content {
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden;
        overflow-y: auto !important;
        min-width: 0;
        height: auto !important;
        min-height: 100vh !important;
    }

    .container {
        max-width: 100%;
        padding: 0.75rem 0.9rem !important;
    }

    .card-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
        padding: 0.9rem 1rem !important;
    }

    .clients-actions {
        width: 100%;
        flex-direction: column;
    }

    .clients-search-input,
    input.clients-search-input,
    input.form-input[style*="min-width"],
    select.form-select[style*="min-width"],
    input[style*="min-width"] {
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100%;
    }

    .card-body {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .card-body table {
        min-width: 500px;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .top-bar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .top-bar-title {
        font-size: 1.3rem;
        word-break: break-word;
    }

    .clients-grid {
        grid-template-columns: 1fr;
        min-width: 0;
    }

    .action-btn-edit,
    .action-btn-delete {
        padding: 0.3rem 0.55rem;
        font-size: 0.8rem;
    }

    table tbody td {
        padding: 0.7rem 0.75rem !important;
        font-size: 0.85rem !important;
    }

    table thead th {
        padding: 0.6rem 0.75rem !important;
    }

    .modal-content {
        border-radius: 20px !important;
        padding: 1.25rem !important;
    }
}

.section-title,
.vsect-title,
h2.section-title {
    color: #000;
}

body.dark-mode .section-title,
body.dark-mode .vsect-title,
body.dark-mode h2.section-title {
    color: #fff;
}

@media (max-width: 768px) {

    html,
    body {
        overflow-y: auto !important;
        height: auto !important;
        min-height: 100vh !important;
        -webkit-overflow-scrolling: touch;
    }

    .main-content,
    #mainContent,
    .container {
        overflow-y: auto !important;
        height: auto !important;
        min-height: 100vh !important;
    }

    .card,
    .d-card,
    .stat-card,
    .section-card {
        height: auto !important;
        min-height: auto !important;
    }

    .dashboard-grid,
    .stats-grid,
    .clients-grid {
        grid-template-columns: 1fr !important;
        height: auto !important;
        max-height: none !important;
    }

    body {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.5rem 0.75rem !important;
    }

    .top-bar-title {
        font-size: 1.1rem !important;
    }
}


/* ═══════════════════════════════════════════════════════════════════════
   SIDEBAR STYLES - Apple Glass Minimal Design
   Clean Implementation - No Layering
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Variables ── */
:root {
    --faunex-sidebar-width: 240px;
    --faunex-sidebar-bg: rgba(255, 255, 255, 0.72);
    --faunex-sidebar-border: rgba(0, 0, 0, 0.08);
    --faunex-sidebar-text: #1d1d1f;
    --faunex-sidebar-text-secondary: #6e6e73;
    --faunex-sidebar-active-bg: rgba(0, 0, 0, 0.04);
}

body.dark-mode {
    --faunex-sidebar-bg: rgba(30, 30, 30, 0.72);
    --faunex-sidebar-border: rgba(255, 255, 255, 0.08);
    --faunex-sidebar-text: #f5f5f7;
    --faunex-sidebar-text-secondary: #a1a1a6;
    --faunex-sidebar-active-bg: rgba(255, 255, 255, 0.08);
}

/* ── Sidebar Container ── */
.faunex-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--faunex-sidebar-width);
    height: 100vh;
    background: var(--faunex-sidebar-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-left: 1px solid var(--faunex-sidebar-border);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transform: translateX(0);
    transition: transform 0.3s ease;
}

/* When sidebar is closed on desktop */
.faunex-sidebar:not(.faunex-sidebar--open) {
    transform: translateX(100%);
}

/* ── Header ── */
.faunex-header {
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--faunex-sidebar-border);
    flex-shrink: 0;
}

.faunex-header__logo {
    display: flex;
    align-items: center;
}

.faunex-header__logo img {
    height: 24px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
}

.faunex-header__logo--dark {
    display: none;
}

body.dark-mode .faunex-header__logo--light {
    display: none;
}

body.dark-mode .faunex-header__logo--dark {
    display: block;
}

.faunex-header__toggle {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--faunex-sidebar-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s;
}

.faunex-header__toggle:hover {
    background: var(--faunex-sidebar-active-bg);
}

.faunex-header__toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.faunex-header__toggle-icon svg {
    width: 20px;
    height: 20px;
}

/* ── Navigation Container ── */
.faunex-nav-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Section ── */
.faunex-section {
    border: 1px solid var(--faunex-sidebar-border);
    border-radius: 10px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.3);
}

body.dark-mode .faunex-section {
    background: rgba(0, 0, 0, 0.2);
}

.faunex-section__label {
    font-size: 11px;
    font-weight: 600;
    color: var(--faunex-sidebar-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 8px 12px 4px;
}

/* ── Navigation ── */
.faunex-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.faunex-nav__item {
    display: block;
}

/* Items with permission/role restrictions are hidden by default */
.faunex-nav__item[data-permission]:not(.faunex-nav__item--visible),
.faunex-nav__item[data-role-required]:not(.faunex-nav__item--visible) {
    display: none;
}

.faunex-nav__item--visible,
.faunex-nav__item[data-permission].faunex-nav__item--visible,
.faunex-nav__item[data-role-required].faunex-nav__item--visible {
    display: block !important;
}

.faunex-nav__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--faunex-sidebar-text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.faunex-nav__link:hover {
    background: var(--faunex-sidebar-active-bg);
    color: var(--faunex-sidebar-text);
}

.faunex-nav__link--active {
    background: var(--faunex-sidebar-active-bg);
    color: var(--faunex-sidebar-text);
    font-weight: 600;
}

.faunex-nav__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--faunex-sidebar-text-secondary);
}

.faunex-nav__icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.5;
}

.faunex-nav__link:hover .faunex-nav__icon,
.faunex-nav__link--active .faunex-nav__icon {
    color: var(--faunex-sidebar-text);
}

/* ── Footer / User ── */
.faunex-footer {
    padding: 16px;
    border-top: 1px solid var(--faunex-sidebar-border);
    flex-shrink: 0;
}

.faunex-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.faunex-user__info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.faunex-user__name {
    font-size: 14px;
    font-weight: 600;
    color: var(--faunex-sidebar-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.faunex-user__role {
    font-size: 12px;
    color: var(--faunex-sidebar-text-secondary);
}

.faunex-user__logout {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--faunex-sidebar-text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    white-space: nowrap;
}

.faunex-user__logout:hover {
    background: var(--faunex-sidebar-active-bg);
    color: var(--faunex-sidebar-text);
}

.faunex-user__logout-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.faunex-user__logout-icon svg {
    width: 16px;
    height: 16px;
}

/* ── Mobile Header ── */
.faunex-mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    padding: 0 16px;
    background: var(--faunex-sidebar-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--faunex-sidebar-border);
    z-index: 999;
}

.faunex-mobile-toggle {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--faunex-sidebar-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.faunex-mobile-toggle__icon svg {
    width: 20px;
    height: 20px;
}

.faunex-mobile-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.faunex-mobile-logo img {
    height: 22px;
    max-width: 100px;
    object-fit: contain;
}

.faunex-mobile-spacer {
    width: 40px;
}

/* ── Floating Toggle (visible when sidebar is closed) ── */
.faunex-floating-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--faunex-sidebar-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--faunex-sidebar-border);
    border-radius: 10px;
    color: var(--faunex-sidebar-text);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.faunex-floating-toggle:hover {
    background: var(--faunex-sidebar-active-bg);
    transform: scale(1.05);
}

.faunex-floating-toggle__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(180deg);
}

.faunex-floating-toggle__icon svg {
    width: 20px;
    height: 20px;
}

/* Show floating toggle when sidebar is closed */
body.faunex-sidebar-active.faunex-sidebar-closed .faunex-floating-toggle {
    display: flex;
}

/* ── Overlay ── */
.faunex-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s;
}

.faunex-overlay--visible {
    display: block;
    opacity: 1;
}

/* ── Body State ── */
body.faunex-sidebar-active #mainContent,
body.faunex-sidebar-active .main-content {
    transition: margin-right 0.3s ease, width 0.3s ease !important;
}

/* Sidebar OPEN - content shrinks */
body.faunex-sidebar-active:not(.faunex-sidebar-closed) #mainContent,
body.faunex-sidebar-active:not(.faunex-sidebar-closed) .main-content {
    margin-right: var(--faunex-sidebar-width) !important;
    width: calc(100% - var(--faunex-sidebar-width)) !important;
    max-width: calc(100% - var(--faunex-sidebar-width)) !important;
}

/* Sidebar CLOSED - content full width */
body.faunex-sidebar-active.faunex-sidebar-closed #mainContent,
body.faunex-sidebar-active.faunex-sidebar-closed .main-content {
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* ── Mobile Responsive ── */
@media (max-width: 768px) {
    .faunex-sidebar {
        transform: translateX(100%);
        width: 280px;
        border-left: none;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    }

    /* On mobile, sidebar is hidden by default, shown when open */
    .faunex-sidebar.faunex-sidebar--open {
        transform: translateX(0);
    }

    /* Hide overlay when sidebar is closed on mobile */
    .faunex-sidebar:not(.faunex-sidebar--open)~.faunex-overlay,
    body:not(.faunex-sidebar-open) .faunex-overlay {
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    .faunex-mobile-header {
        display: none !important;
    }

    body.faunex-sidebar-active #mainContent,
    body.faunex-sidebar-active .main-content,
    body.faunex-sidebar-active.faunex-sidebar-closed #mainContent,
    body.faunex-sidebar-active.faunex-sidebar-closed .main-content {
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding-top: 16px !important;
    }
}

@media (min-width: 769px) {

    .faunex-mobile-header,
    .faunex-overlay {
        display: none !important;
    }

    /* On desktop, sidebar is visible by default */
    .faunex-sidebar {
        transform: translateX(0) !important;
    }

    /* When explicitly closed on desktop */
    .faunex-sidebar:not(.faunex-sidebar--open) {
        transform: translateX(100%) !important;
    }
}

/* ── Print ── */
@media print {

    .faunex-sidebar,
    .faunex-mobile-header {
        display: none !important;
    }

    body.faunex-sidebar-active #mainContent,
    body.faunex-sidebar-active .main-content {
        margin-right: 0 !important;
        width: 100% !important;
    }
}

/* ── Global Loading Spinner (Silent Pill Loading) ── */
.loading-overlay,
.loading-spinner {
    position: fixed;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: var(--card-bg, #fff) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 8px 16px;
    border-radius: 30px;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    pointer-events: none;
    transition: opacity 0.3s ease;
    width: auto !important;
    height: auto !important;
    border: none !important;
    animation: none !important;
}

body.dark-mode .loading-overlay,
body.dark-mode .loading-spinner {
    background: rgba(44, 44, 46, 0.88);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #fff;
}

.loading-overlay.active,
.loading-spinner.active {
    display: flex !important;
    animation: fadeIn 0.3s ease forwards !important;
    opacity: 1 !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -10px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Make sure we provide the inner spinner design even if it's .loading-spinner which didn't have inner .spinner before */
.loading-overlay .spinner,
.loading-spinner::after {
    content: "";
    width: 24px !important;
    height: 24px !important;
    border: 3px solid rgba(var(--primary-rgb, 57, 208, 227), 0.15) !important;
    border-top: 3px solid var(--primary) !important;
    border-radius: 50% !important;
    animation: spin .9s linear infinite !important;
    display: block !important;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Data Update Highlight Effect ── */
.highlight-update {
    animation: highlightFade 1.2s ease-out forwards;
}

@keyframes highlightFade {
    0% {
        background-color: rgba(39, 174, 96, 0.5);
        color: #fff;
        border-radius: 4px;
        padding: 0 6px;
        display: inline-block;
    }

    100% {
        background-color: transparent;
        color: inherit;
        border-radius: 4px;
        padding: 0 6px;
        display: inline-block;
    }
}

/* ── Section Initial Load Fade ── */
.card,
.d-card,
.stat-card,
.section-card,
.appointment-card,
.boarding-card,
.apt-card,
.exam-card,
.inventory-card,
.client-card,
.pet-card {
    animation: softFadeIn 0.4s ease-out forwards;
}

@keyframes softFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}