:root {
    --sidebar-width: 260px;
    --header-height: 72px;
}

body.collapsed {
    --sidebar-width: 110px;
}

body {
    overflow-x: hidden;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

/* ==========================================================================
   Base Layout
   ========================================================================== */
#sidebarArea {
    width: var(--sidebar-width);
    transition: width 0.3s ease;
}

#mainArea {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    max-width: 100%;
    transition: all 0.3s ease;
}

#header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    z-index: 40;
    transition: all 0.3s ease;
}

main {
    padding-top: calc(var(--header-height) + 20px) !important;
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 40px;
    min-width: 0;
}

/* ==========================================================================
   Sidebar Components
   ========================================================================== */
.sidebar.collapsed {
    width: var(--sidebar-width) !important;
}

.sidebar.collapsed .sidebar-full,
.sidebar.collapsed .sidebar-mini+.sidebar-full {
    display: none !important;
}

.sidebar.collapsed .sidebar-mini {
    display: block !important;
}

.sidebar.collapsed .nav-item {
    flex-direction: column !important;
    justify-content: center;
    padding: 12px 4px !important;
    gap: 6px;
}

.sidebar.collapsed .nav-item i {
    font-size: 22px;
    width: auto !important;
}

.sidebar.collapsed .sidebar-text {
    display: block !important;
    font-size: 10px;
    line-height: 1;
    text-align: center;
    margin-top: 4px;
    font-weight: 500;
}

.nav-item.active {
    background: #fff1f2 !important;
    color: #e11d48 !important;
}

.nav-item.active i,
.nav-item.active .sidebar-text {
    color: #e11d48 !important;
}

.nav-item.active .sidebar-text {
    font-weight: 600 !important;
}

/* ==========================================================================
   Mobile Dock (macOS Style)
   ========================================================================== */
.mobile-dock {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    padding: 10px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    display: none;
    width: auto;
    max-width: 90%;
    overflow-x: auto;
    scrollbar-width: none;
    transition: all 0.3s ease;
}

.mobile-dock::-webkit-scrollbar {
    display: none;
}

.dock-item {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 14px;
    color: #4b5563;
    text-decoration: none;
    font-size: 22px;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.dock-item.active {
    background: #f43f5e;
    color: white;
    box-shadow: 0 5px 15px rgba(244, 63, 94, 0.3);
}

.dock-item:active {
    transform: scale(0.85);
}

/* ==========================================================================
   Tables & Data
   ========================================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    scrollbar-width: none;
}

.table-responsive::-webkit-scrollbar {
    display: none;
}

.table-responsive table {
    min-width: 850px;
}

/* ==========================================================================
   RESPONSIVE DESIGN (Media Queries)
   ========================================================================== */

/* TABLET & MOBILE (Up to 1024px) */
@media (max-width: 1024px) {
    #sidebarArea {
        display: none !important;
    }

    #mainArea,
    #mainArea.collapsed {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    #header {
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 60px !important;
        /* Compact header on mobile */
    }

    #header header {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }

    #sidebarToggle,
    #collapseSidebar {
        display: none !important;
    }

    main {
        padding-top: 76px !important;
        /* 60px header + 16px gap */
        padding-bottom: 110px !important;
    }

    .mobile-dock {
        display: flex !important;
    }

    /* Force full width for search groups that might be capped on desktop */
    .search-group,
    .search-container {
        max-width: 100% !important;
        width: 100% !important;
    }

    /* Global Mobile Spacing Fixes */
    .p-10,
    .p-8,
    .p-6,
    .p-7 {
        padding: 1.25rem !important;
    }

    .px-8 {
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
    }

    .mb-12,
    .mb-10 {
        margin-bottom: 0.75rem !important;
    }

    .py-8,
    .py-6 {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }

    .mb-12.stats-grid {
        margin-bottom: 1.5rem !important;
    }

    .mobile-flex-col {
        flex-direction: column !important;
    }

    select,
    input,
    button {
        font-size: 14px !important;
    }

    /* Fix inquiries layout height on mobile */
    .inquiry-grid {
        height: calc(100vh - 60px) !important;
    }
}

/* MOBILE SPECIFIC (Up to 640px) */
@media (max-width: 640px) {
    main {
        padding-left: 16px !important;
        padding-right: 16px !important;
        padding-top: 72px !important;
        /* 60px header + 12px gap */
    }

    .stats-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }

    .table-responsive th,
    .table-responsive td {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        white-space: nowrap;
    }

    /* Force Table Actions visibility on touch */
    .table-responsive .opacity-0.group-hover\:opacity-100 {
        opacity: 1 !important;
    }

    .responsive-title {
        font-size: 1.5rem !important;
        line-height: 2rem !important;
    }

    .mobile-hide {
        display: none !important;
    }
}