/* --- UI LAYOUT & NAVIGATION --- */

/* Header & Sticky Rules */
.header-sticky {
    position: sticky;
    top: 0;
    z-index: 30;
    transition: all 0.3s ease;
}

.main-content-height {
    height: calc(100vh - 4rem);
}

.scrollable-body {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
}

.glass-header {
    background-color: var(--nav-bg) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    backdrop-filter: blur(12px) !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 4px 6px -1px var(--shadow-color), 0 2px 4px -2px var(--shadow-color) !important;
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
    margin: 1rem; /* Reduced from 24px for better space utilization */
    border-radius: 12px;
    /* Optional: Ensure z-index is lower than dropdowns but high enough for content */
    z-index: 10 !important;
}

/* Sidebar & Navigation */
.sidebar-btn {
    transition: all 0.3s ease;
}

/* Sidebar Section Headers (Uiverse style) */
.sidebar-section-btn {
  --primary-color: var(--text-muted);
  --hovered-color: var(--accent);
  position: relative;
  display: flex;
  font-weight: 900;
  font-size: 10px;
  gap: 0.5rem;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 8px 12px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
}

.sidebar-section-btn span {
  margin: 0;
  position: relative;
  color: var(--primary-color);
  transition: 0.3s ease-out;
}

.sidebar-section-btn::after {
  position: absolute;
  content: "";
  width: 0;
  left: 12px;
  bottom: 4px;
  background: var(--hovered-color);
  height: 2px;
  transition: 0.3s ease-out;
}

.sidebar-section-btn span::before {
  position: absolute;
  content: attr(data-text);
  width: 0%;
  inset: 0;
  color: var(--hovered-color);
  overflow: hidden;
  transition: 0.3s ease-out;
  white-space: nowrap;
}

.sidebar-section-btn:hover::after,
.sidebar-section-btn.expanded::after {
  width: calc(100% - 24px);
}

.sidebar-section-btn:hover span::before,
.sidebar-section-btn.expanded span::before {
  width: 100%;
}

.sidebar-section-btn:hover svg,
.sidebar-section-btn.expanded svg {
  transform: translateX(4px);
  color: var(--hovered-color);
}

.sidebar-section-btn svg {
  color: var(--primary-color);
  transition: 0.2s;
  position: relative;
  width: 12px;
  transition-delay: 0.1s;
}

/* Hide divider/arrow logic for collapsed sidebar is handled in sidebar.php <style> */

/* --- PREMIUM DROPDOWN STYLES --- */
.dropdown-premium {
    position: absolute;
    z-index: 50;
    background-color: #ffffff;
    border-radius: 12px;
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    min-width: 200px;
}

.dark .dropdown-premium {
    background-color: #1f2937;
    border-color: #374151;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.dropdown-premium .separator {
    border-top: 1px solid #e5e7eb;
    margin: 4px 0;
}

.dark .dropdown-premium .separator {
    border-top-color: #374151;
}

.dropdown-premium-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 8px;
}

.dropdown-menu,
[data-dropdown-menu],
.relative > .absolute.bg-white.rounded-xl.shadow-lg {
    z-index: 50 !important;
}

.dropdown-premium-item {
    display: flex;
    align-items: center;
    color: #374151;
    gap: 10px;
    transition: all 0.3s ease-out;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none !important;
}

.dark .dropdown-premium-item {
    color: #d1d5db;
}

.dropdown-premium-item svg {
    width: 18px;
    height: 18px;
    transition: all 0.3s ease-out;
}

.dropdown-premium-item .label {
    font-weight: 600;
    font-size: 13px;
}

.dropdown-premium-item:hover {
    background-color: #1f2937;
    color: #ffffff !important;
    transform: translate(1px, -1px);
}

.dark .dropdown-premium-item:hover {
    background-color: #374151;
}

.dropdown-premium-item:hover svg {
    stroke: #ffffff !important;
}

.dropdown-premium-item:active {
    transform: scale(0.98);
}

/* --- UNITYKIT BRANDING --- */
.unitykit-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none !important;
    height: 48px;
    padding: 5px 16px;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    background: transparent;
}

.unitykit-brand:hover {
    background: rgba(249, 115, 22, 0.08); /* fallback for orange-500 alpha */
    transform: translateY(-1px);
}

.unitykit-logo-box {
    position: relative;
    width: 200px;
    height: 32px;
    display: flex;
    align-items: center;
    overflow: hidden;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.unitykit-icon-svg {
    height: 30px;
    width: 60px;
    flex-shrink: 0;
    fill: #f97316;
}

.dark .unitykit-icon-svg {
    fill: #fb923c;
}

.unitykit-text-svg {
    height: 24px;
    margin-left: 12px;
    opacity: 1;
    transform: translateX(0);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    fill: #1e293b;
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    font-size: 24px;
    letter-spacing: -0.8px;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.dark .unitykit-text-svg {
    fill: #f8fafc;
}

/* Removed hover opacity shift */

/* --- PREMIUM HAMBURGER MENU --- */
.hamburger {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.hamburger:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.dark .hamburger:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.hamburger input {
    display: none !important;
}

.hamburger svg {
    height: 2.2em;
    transition: transform 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.hamburger .line {
    fill: none;
    stroke: #1f2937; /* Monochrome Dark */
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.5;
    transition: stroke-dasharray 600ms cubic-bezier(0.4, 0, 0.2, 1),
                stroke-dashoffset 600ms cubic-bezier(0.4, 0, 0.2, 1),
                stroke 0.3s ease;
}

.dark .hamburger .line {
    stroke: #f3f4f6;
}

.hamburger .line-top-bottom {
    stroke-dasharray: 12 63;
}

.hamburger input:checked + svg {
    transform: rotate(-45deg);
}

.hamburger input:checked + svg .line-top-bottom {
    stroke-dasharray: 20 300;
    stroke-dashoffset: -32.42;
}

/* --- DARK MODE OVERRIDES (LAYOUT) --- */
html.dark nav {
    background-color: var(--surface) !important;
    border-bottom-color: var(--border) !important;
}

html.dark .header-sticky {
    background-color: var(--nav-bg) !important;
    border-bottom-color: var(--border) !important;
}

html.dark #sidebar > div {
    background-color: var(--sidebar-bg) !important;
    border-right-color: var(--border) !important;
}

html.dark #sidebar .border-b {
    background-color: var(--sidebar-bg) !important;
    border-color: var(--border) !important;
}

html.dark .sidebar-btn {
    background: var(--sidebar-btn-bg) !important;
    color: var(--sidebar-btn-text) !important;
}

html.dark .sidebar-btn::before {
    background-color: var(--sidebar-btn-hover-bg) !important;
}

html.dark .sidebar-btn:hover,
html.dark .sidebar-btn.active {
    color: var(--sidebar-btn-hover-text) !important;
}

html.dark .sidebar-btn.active {
    background: var(--accent) !important;
}

html.dark .sidebar-btn.active::before {
    background-color: var(--accent-hover) !important;
}

html.dark .role-tab.bg-white {
    background-color: #2a2a3a !important;
    color: #f97316 !important;
}

/* --- GEOLOGY LIBRARY MODALS & COMPONENTS --- */
.geology-img-btn {
    width: 60px;
    height: 60px;
}

#modal_main_card {
    position: relative;
    z-index: 20;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#details_side_panel {
    position: absolute;
    left: 50%;
    top: 40px;
    bottom: 40px;
    width: 450px;
    z-index: 10;
    transform: translateX(-50%) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

#viewModal.details-open #modal_main_card {
    transform: translateX(-225px);
}

#viewModal.details-open #details_side_panel {
    transform: translateX(200px) scale(1);
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 1280px) {
    #viewModal.details-open #modal_main_card {
        transform: translateX(0);
    }
    #details_side_panel {
        position: fixed;
        right: 0;
        left: auto;
        top: 0;
        bottom: 0;
        height: 100vh;
        width: 400px;
        border-radius: 0;
        z-index: 70;
        transform: translateX(100%);
    }
    #viewModal.details-open #details_side_panel {
        transform: translateX(0);
    }
}
