/* CSS Variables - Blue & White Medical Theme */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --secondary-color: #3b82f6;
    --accent-color: #60a5fa;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --success-color: #22c55e;
    --dark-bg: #0f172a;
    --light-bg: #f8fafc;
    --sidebar-bg: #1e293b;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --radius-lg: 1rem;
    --radius-md: 0.75rem;
    --radius-sm: 0.5rem;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

/* Animations */
@keyframes scaleUp {
    from {
        opacity: 0;
        transform: scale(0.98) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.animate-entry {
    animation: scaleUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Glassmorphism Utilities */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--radius-lg);
}

.glass-header {
    background: rgba(255, 255, 255, 0.75) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border) !important;
}

html,
body {
    max-width: 100%;
    position: relative;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-main);
    font-weight: 700;
}

/* Sidebar primary definition */
.sidebar {
    height: 100vh;
    background: var(--sidebar-bg);
    color: white;
    width: 280px;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Sidebar Hide State (Mobile Default & Desktop Triggered) */
@media (max-width: 991.98px) {
    .sidebar {
        width: 270px;
        max-width: 75vw;
        height: 100vh;
        transform: translateX(-100%);
        background: var(--sidebar-bg);
        z-index: 1055;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    /* Body lock when sidebar is open */
    body.sidebar-open {
        overflow: hidden !important;
    }

    .btn-close-sidebar {
        display: flex !important;
        position: absolute;
        top: 15px;
        right: 15px;
        width: 35px;
        height: 35px;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.1);
        border: none;
        border-radius: 50%;
        color: white;
        z-index: 2001;
        transition: var(--transition);
    }

    .btn-close-sidebar:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: rotate(90deg);
    }
}

.btn-close-sidebar {
    display: none;
}


/* Sidebar Collapsed State (Desktop) */
@media (min-width: 992px) {
    body.sidebar-collapsed .sidebar {
        width: 80px;
    }

    body.sidebar-collapsed .main-content {
        margin-left: 80px !important;
    }

    body.sidebar-collapsed .sidebar .profile-info,
    body.sidebar-collapsed .sidebar .sidebar-search,
    body.sidebar-collapsed .sidebar .nav-item span,
    body.sidebar-collapsed .sidebar .nav-section-header span,
    body.sidebar-collapsed .sidebar .nav-section-header .toggle-icon,
    body.sidebar-collapsed .sidebar .logout-btn span {
        display: none;
    }

    body.sidebar-collapsed .sidebar .nav-item {
        justify-content: center;
        padding: 0.85rem 0;
    }

    body.sidebar-collapsed .sidebar .nav-item i {
        font-size: 1.4rem;
        margin: 0;
    }

    body.sidebar-collapsed .sidebar .nav-section-header {
        justify-content: center;
        padding: 0.9rem 0;
        margin-left: 5px;
        margin-right: 5px;
    }

    body.sidebar-collapsed .sidebar .nav-section-header i:first-child {
        margin: 0;
    }

    body.sidebar-collapsed .sidebar .nav-section-content .nav-item {
        padding-left: 0;
    }

    body.sidebar-collapsed .sidebar .sidebar-profile {
        padding: 1rem 0;
        justify-content: center;
    }

    body.sidebar-collapsed .sidebar .profile-avatar {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
}

/* Desktop Hidden State */
body.sidebar-hidden .sidebar {
    transform: translateX(-100%);
}

body.sidebar-hidden .main-content {
    margin-left: 0 !important;
}

/* Sidebar Profile Section */
.sidebar-profile {
    padding: 2rem 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.profile-info {
    flex: 1;
    min-width: 0;
}

.profile-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-role {
    font-size: 0.7rem;
    color: var(--secondary-color);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Sidebar Search */
.sidebar-search {
    padding: 1.25rem 1.5rem;
    flex-shrink: 0;
    position: relative;
}

.sidebar-search i {
    position: absolute;
    left: 2.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
}

.sidebar-search input {
    width: 100%;
    padding: 0.6rem 0.6rem 0.6rem 2.25rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    font-size: 0.85rem;
    transition: var(--transition);
}

.sidebar-search input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.sidebar-search input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
    padding-bottom: 120px;
}

/* Custom Scrollbar for Sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

/* Navigation Items */
.nav-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none !important;
    transition: var(--transition);
    border-radius: 10px;
    margin: 2px 0;
    font-weight: 500;
    position: relative;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    transition: var(--transition);
}

.nav-item span {
    font-size: 0.875rem;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.nav-item.active i {
    color: white;
}

/* Navigation Sections */
.nav-section {
    margin: 1.25rem 0 0.25rem 0;
}

.nav-section-header {
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    font-weight: 800;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    user-select: none;
    transition: var(--transition);
}

.nav-section-header:hover {
    color: rgba(255, 255, 255, 0.7);
}

.nav-section-header i:first-child {
    display: none;
}

.nav-section-header span {
    flex: 1;
}

.nav-section-header .toggle-icon {
    font-size: 0.7rem;
    transition: transform 0.3s;
}

.nav-section-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.nav-section-content {
    transition: var(--transition);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 10px;
    color: #f87171;
    text-decoration: none !important;
    transition: var(--transition);
    font-weight: 600;
    font-size: 0.875rem;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    transform: translateX(3px);
}

/* Main Wrapper */
.main-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Main Layout */
.main-content {
    margin-left: 280px;
    padding: 2.5rem;
    transition: margin-left 0.3s ease, padding 0.3s ease;
    flex: 1;
    min-height: calc(100vh - 60px);
}

/* -------------------------------------------------------------------------- */
/*                               MOBILE OVERRIDES                             */
/* -------------------------------------------------------------------------- */

@media (max-width: 991.98px) {
    .main-content {
        margin-left: 0 !important;
        padding: 1rem !important;
        padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)) !important;
        padding-top: calc(70px + env(safe-area-inset-top, 0px)) !important;
        /* Space for mobile nav */
        width: 100% !important;
    }

    .main-wrapper {
        padding-top: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 1050;
    }

    .sidebar-overlay.show {
        display: block;
    }

    /* Top Nav Bar on Mobile */
    /* iOS Status Bar & Safe Areas */
    .mobile-nav {
        display: flex !important;
        height: calc(56px + env(safe-area-inset-top, 0px));
        align-items: center;
        justify-content: space-between;
        padding: env(safe-area-inset-top, 0px) 1rem 0 1rem;
        background: white !important;
        color: var(--text-main);
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1045;
        border-bottom: 1px solid var(--border-color);
    }

    .mobile-nav .brand-sm {
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        font-weight: 700;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
        color: var(--primary-color);
        font-size: 1.1rem;
        pointer-events: none;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .brand-sm {
        font-size: 1.1rem;
    }

    /* Floating Bottom Nav - Designed for Thumbs */
    /* Flush Bottom Nav - Standard Mobile Pattern */
    .mobile-bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(65px + env(safe-area-inset-bottom, 0px));
        background: #ffffff !important;
        border-top: 1px solid var(--border-color);
        border-radius: 0;
        z-index: 1045;
        box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.05);
        justify-content: space-around;
        align-items: flex-start;
        padding: 8px 5px calc(8px + env(safe-area-inset-bottom, 0px)) 5px;
    }

    /* Typography scale for Mobile */
    h1,
    .h1 {
        font-size: 1.6rem !important;
    }

    h2,
    .h2 {
        font-size: 1.4rem !important;
    }

    .card-dashboard h2 {
        font-size: 1.8rem !important;
    }

    /* Table Fixes */
    .table-responsive {
        border: 0;
        margin-bottom: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table td,
    .table th {
        white-space: nowrap;
        font-size: 0.85rem;
        padding: 0.6rem 0.4rem;
    }

    /* Card adjustments */
    .card {
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Button adjustments */
    .btn {
        font-size: 0.9rem;
    }

    /* Hide desktop top bar on mobile */
    .desktop-top-bar {
        display: none !important;
    }
}

@media (min-width: 992px) {
    .mobile-nav,
    .mobile-bottom-nav {
        display: none !important;
    }
}
.mobile-bottom-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.65rem;
    text-decoration: none !important;
    transition: 0.2s;
    flex: 1;
}

.mobile-bottom-item i {
    font-size: 1.4rem;
    margin-bottom: 3px;
}

.mobile-bottom-item.active {
    color: var(--primary-color);
}

.mobile-bottom-item.menu-trigger {
    flex: 0 0 54px;
    width: 54px;
    height: 54px;
    background: var(--primary-color);
    color: white !important;
    border-radius: 16px;
    justify-content: center;
    margin-top: -24px;
    box-shadow: 0 8px 15px rgba(37, 99, 235, 0.3);
    border: 4px solid white;
    z-index: 5001;
}

/* Dashboard & Cards */
.card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* Vibrant Gradient Cards */
.bg-gradient-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
}

.bg-gradient-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
}

.bg-gradient-info {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%) !important;
}

.bg-gradient-secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%) !important;
}

.bg-gradient-dark {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 24px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}
.timeline-item {
    position: relative;
}
.timeline-dot {
    position: absolute;
    left: -21px;
    top: 6px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #2563eb;
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px #2563eb;
    z-index: 1;
}

.card-dashboard {
    position: relative;
    overflow: hidden;
    color: white;
    border: none;
    min-height: 120px;
}

.card-dashboard h2 {
    color: white;
    font-size: 2.25rem;
    margin-bottom: 0.25rem;
}

.card-dashboard .card-title {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.75px;
    font-weight: 700;
}

.card-icon {
    position: absolute;
    right: 20px;
    bottom: 20px;
    font-size: 3.5rem;
    opacity: 0.2;
    transform: rotate(-10deg);
}

/* Sidebar transforms removed - consolidated above */

/* Desktop Top Bar */
.desktop-top-bar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    padding: 0.75rem 2rem;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 992px) {
    .desktop-top-bar {
        display: flex;
        margin-left: 280px;
        width: calc(100% - 280px);
    }

    body.sidebar-collapsed .desktop-top-bar {
        margin-left: 80px;
        width: calc(100% - 80px);
    }

    body.sidebar-hidden .desktop-top-bar {
        margin-left: 0;
        width: 100%;
    }
}

.btn-control {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-control:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
}

/* Print Styles */
@media print {

    .no-print,
    .sidebar,
    .mobile-nav,
    .mobile-bottom-nav,
    .desktop-top-bar,
    .sidebar-overlay {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    body {
        background: white;
    }
}

/* Additional Link Styles */
a {
    text-decoration: none;
    color: inherit;
}

a:hover {
    text-decoration: none;
}

/* ========================================================================== */
/*                        ENHANCED RESPONSIVE DESIGN                          */
/* ========================================================================== */

/* Tablet Breakpoint overrides removed - consolidated above */

@media (min-width: 992px) {
    .main-content {
        margin-left: 280px;
        padding: 2.5rem;
    }

    body.sidebar-hidden .main-content {
        margin-left: 0;
    }
}

/* Card Grid Adjustments */
.row .col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
}

.row .col-md-4 {
    flex: 0 0 50%;
    max-width: 50%;
}

/* Form Adjustments */
.form-control,
.form-select {
    height: 48px;
    font-size: 0.95rem;
}

.btn {
    padding: 0.7rem 1.3rem;
    font-size: 0.95rem;
}

/* Small Tablet / Large Phone (576px - 767px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .main-content {
        padding: 1.5rem;
        padding-bottom: 100px;
    }

    /* Stack cards vertically */
    .row .col-md-6,
    .row .col-md-4,
    .row .col-md-3 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 1rem;
    }

    /* Adjust card padding */
    .card-body {
        padding: 1.25rem;
    }

    /* Form improvements */
    .form-control,
    .form-select {
        height: 50px;
        font-size: 1rem;
    }

    /* Button improvements */
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 1rem;
    }

    /* Table improvements */
    .table {
        font-size: 0.9rem;
    }

    .table td,
    .table th {
        padding: 0.75rem;
    }
}

/* Mobile Enhancements (below 576px) */
@media (max-width: 575.98px) {

    /* Typography */
    h1,
    .h1 {
        font-size: 1.5rem !important;
    }

    h2,
    .h2 {
        font-size: 1.3rem !important;
    }

    h3,
    .h3 {
        font-size: 1.15rem !important;
    }

    h4,
    .h4 {
        font-size: 1rem !important;
    }

    /* Cards */
    .card {
        border-radius: 15px;
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .card-header {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }

    /* Forms */
    .form-control,
    .form-select,
    textarea.form-control {
        font-size: 16px;
        /* Prevents zoom on iOS */
        height: 50px;
        border-radius: 10px;
    }

    textarea.form-control {
        height: auto;
        min-height: 100px;
    }

    .form-label {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }

    /* Buttons */
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
        border-radius: 10px;
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .btn-sm {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        width: auto;
    }

    /* Tables */
    .table-responsive {
        border-radius: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        font-size: 0.85rem;
        min-width: 600px;
    }

    .table td,
    .table th {
        padding: 0.6rem 0.5rem;
        white-space: nowrap;
    }

    .table thead th {
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
    }

    /* Badges */
    .badge {
        font-size: 0.75rem;
        padding: 0.35em 0.65em;
    }

    /* Modals */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-content {
        border-radius: 15px;
        background-color: #ffffff !important;
        z-index: 1060;
        opacity: 1 !important;
        visibility: visible !important;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    }

    .modal-header,
    .modal-footer {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    /* Alerts */
    .alert {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
        border-radius: 10px;
    }

    /* Breadcrumb */
    .breadcrumb {
        font-size: 0.85rem;
        padding: 0.5rem 0;
    }

    /* Pagination */
    .pagination {
        font-size: 0.9rem;
    }

    .page-link {
        padding: 0.5rem 0.75rem;
    }
}

/* Landscape Mobile Optimization */
@media (max-width: 991.98px) and (orientation: landscape) {
    .mobile-bottom-nav {
        height: 60px;
        bottom: 10px;
    }

    .mobile-bottom-item {
        font-size: 0.6rem;
    }

    .mobile-bottom-item i {
        font-size: 1.2rem;
    }

    .main-content {
        padding-bottom: 90px !important;
    }
}

/* Ultra-wide screens (1920px+) */
@media (min-width: 1920px) {
    .main-content {
        max-width: 1800px;
        margin-left: auto;
        margin-right: auto;
        padding-left: calc(280px + 2rem);
    }

    .container-fluid {
        max-width: 1800px;
    }
}

/* High DPI / Retina Displays */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    .card {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

    .btn {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {

    /* Larger touch targets */
    .btn,
    .nav-item,
    .mobile-bottom-item {
        min-height: 48px;
        min-width: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Better tap feedback */
    .btn:active,
    .nav-item:active,
    .mobile-bottom-item:active {
        transform: scale(0.96) !important;
        background: rgba(0, 0, 0, 0.05);
        transition: transform 0.1s;
    }
}

/* Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode Support (Future Enhancement) */
@media (prefers-color-scheme: dark) {
    /* Placeholder for dark mode styles */
    /* Can be implemented later if needed */
}

/* Container Max-Width Adjustments */
.container {
    max-width: 100%;
    padding-right: 15px;
    padding-left: 15px;
}

@media (min-width: 576px) {
    .container {
        max-width: 540px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
}

@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

/* Utility Classes for Responsive Display */
.d-mobile-none {
    display: none;
}

@media (min-width: 768px) {
    .d-mobile-none {
        display: block;
    }

    .d-desktop-none {
        display: none;
    }
}

/* Responsive Spacing Utilities */
@media (max-width: 767.98px) {
    .mb-mobile-3 {
        margin-bottom: 1rem !important;
    }

    .mt-mobile-3 {
        margin-top: 1rem !important;
    }

    .p-mobile-2 {
        padding: 0.5rem !important;
    }
}

/* ========================================================================== */
/*                        iOS / iPhone SPECIFIC FIXES                         */
/* ========================================================================== */

/* iOS Safe Area Support */
@supports (padding: max(0px)) {
    body {
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: env(safe-area-inset-right, 0px);
    }

    .mobile-nav {
        padding-left: max(1.25rem, env(safe-area-inset-left, 0px));
        padding-right: max(1.25rem, env(safe-area-inset-right, 0px));
    }

    .mobile-bottom-nav {
        left: max(10px, env(safe-area-inset-left, 0px));
        right: max(10px, env(safe-area-inset-right, 0px));
        bottom: max(15px, env(safe-area-inset-bottom, 0px));
    }
}

/* iOS Viewport Fix */
@supports (-webkit-touch-callout: none) {

    /* iOS Safari specific */
    body {
        min-height: -webkit-fill-available;
    }

    html {
        height: -webkit-fill-available;
    }
}

/* iOS Input Zoom Prevention */
@media screen and (max-width: 767px) {

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px !important;
        /* Prevents zoom on iOS */
    }
}

/* iOS Smooth Scrolling */
.sidebar-nav,
.table-responsive,
.main-content {
    -webkit-overflow-scrolling: touch;
}

/* iOS Button Fix */
button,
input[type="submit"],
input[type="button"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* iOS Active State Fix */
.nav-item,
.btn,
.mobile-bottom-item {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* iOS Sticky Position Fix */
@supports (-webkit-overflow-scrolling: touch) {
    .mobile-nav {
        position: -webkit-sticky;
        position: sticky;
    }

    .desktop-top-bar {
        position: -webkit-sticky;
        position: sticky;
    }
}

/* iOS Text Selection */
* {
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}

button,
.btn,
.nav-item {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* iOS Momentum Scrolling */
body,
.sidebar,
.main-content {
    -webkit-overflow-scrolling: touch;
}

/* iOS Rubber Band Effect Fix */
body {
    overscroll-behavior-y: none;
}

/* iOS Status Bar */
@media (max-width: 991.98px) {
    .mobile-nav {
        padding-top: max(1rem, env(safe-area-inset-top, 0px));
        min-height: calc(60px + env(safe-area-inset-top, 0px));
    }
}

/* iOS Landscape Mode */
@media (max-width: 991.98px) and (orientation: landscape) {
    .mobile-nav {
        height: 50px;
        min-height: 50px;
    }

    .main-content {
        padding-top: 60px !important;
    }
}

/* iOS Form Styling */
input,
select,
textarea {
    -webkit-appearance: none;
    appearance: none;
    -webkit-border-radius: 12px;
    border-radius: 12px;
}

/* iOS Click Delay Fix */
a,
button,
input,
select,
textarea,
label,
.btn,
.nav-item {
    touch-action: manipulation;
}

/* iOS Font Smoothing */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* iOS Sidebar Fix consolidated above */

/* iOS Card Rendering */
.card {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    backface-face-visibility: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* iOS Animation Performance */
@media (min-width: 992px) {

    .sidebar,
    .nav-item,
    .btn-control {
        will-change: transform;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Ensure mobile sidebar uses hardware acceleration without overriding translateX */
@media (max-width: 991.98px) {
    .sidebar {
        will-change: transform;
    }
}
