/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Colors - Light Theme - Portal Gold Theme */
  --primary: #d9a116;
  --primary-dark: #b7830e;
  --secondary: #5f6368;
  --success: #1e8e3e;
  --danger: #d93025;
  --warning: #f9ab00;
  --bg: #f9f9fb;
  --bg-secondary: #f8f9fa;
  --surface: #ffffff;
  --text: #1f2224;
  --text-secondary: #5f6368;
  --border: #e5e7eb;
  --shadow: rgba(0, 0, 0, 0.1);
  --shadow-md: rgba(0, 0, 0, 0.15);
  
  /* Spacing */
  --header-height: 56px;
  --sidebar-width: 280px;
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  
  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.5rem;
  --font-size-xxl: 2rem;
  
  /* Transitions */
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme */
body.dark-theme {
  --primary: #ffd367;
  --primary-dark: #ffbf26;
  --bg: #0f172a;
  --bg-secondary: #1e293b;
  --surface: #1e293b;
  --text: #e8eaed;
  --text-secondary: #9aa0a6;
  --border: #334155;
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-md: rgba(0, 0, 0, 0.4);
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.screen {
  min-height: 100vh;
}

/* Login Screen */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--spacing-md);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 12px;
  padding: var(--spacing-xl);
  box-shadow: 0 4px 20px var(--shadow-md);
}

.login-card a[href="https://office.tiongmas.my"]:hover {
  color: #b7830e !important;
}

.login-card a[href="https://office.tiongmas.my"]:hover span:last-child {
  border-bottom-color: #b7830e !important;
}

.login-card h1 {
  font-size: var(--font-size-xxl);
  font-weight: 600;
  margin-bottom: var(--spacing-xl);
  text-align: center;
  color: var(--text);
}

/* Clean Header Styles */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 250;
  backdrop-filter: blur(8px);
}

.header-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
  letter-spacing: 0.5px;
}

.menu-toggle {
  display: none; /* Hidden on desktop */
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 0.25rem;
}

.menu-toggle span {
  width: 20px;
  height: 2px;
  background: var(--text);
  transition: all 0.3s ease;
}

.theme-toggle {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background: var(--hover-bg);
  transform: scale(1.1);
}

/* Fix main content spacing and layout */
.main-content {
  margin-left: 250px;
  margin-top: var(--header-height);
  padding: 1.5rem;
  transition: margin-left 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  min-height: calc(100vh - var(--header-height));
}

.sidebar.collapsed + .main-content {
  margin-left: 60px;
}

/* Remove conflicting styles */
@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }
  
  .main-content {
    margin-left: 0;
    padding: 1rem;
  }
  
  .sidebar.collapsed + .main-content {
    margin-left: 0;
  }
}

.sidebar.open {
  transform: translateX(0);
  box-shadow: 4px 0 8px var(--shadow);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
}

.sidebar-header h2 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text);
}

.sidebar-close {
  width: 44px;
  height: 44px;
  font-size: 2rem;
  line-height: 1;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  transition: background var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

.sidebar-close:hover {
  background: var(--bg-secondary);
}

.nav-list {
  list-style: none;
  padding: var(--spacing-md) 0;
}

.nav-link {
  display: block;
  padding: var(--spacing-md) var(--spacing-lg);
  color: var(--text);
  text-decoration: none;
  font-size: var(--font-size-base);
  transition: background var(--transition);
}

.nav-link:hover {
  background: var(--bg-secondary);
}

.nav-link.active {
  background: var(--bg-secondary);
  color: var(--primary);
  font-weight: 500;
}

/* Main Content */
.main-content {
  padding-top: var(--header-height);
  min-height: 100vh;
  background: var(--bg);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-lg);
}

/* Form Elements */
.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-group label {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-weight: 500;
  color: var(--text);
  font-size: var(--font-size-sm);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  font-size: var(--font-size-base);
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all var(--transition);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: 12px 24px;
  font-size: var(--font-size-base);
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #c5221f;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #188038;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 8px 16px;
  font-size: var(--font-size-sm);
  min-height: 36px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  box-shadow: 0 1px 3px var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-lg);
  gap: var(--spacing-md);
}

.card-header h2 {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--text);
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  color: var(--text);
}

/* Tables */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 calc(-1 * var(--spacing-lg));
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

thead {
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
}

th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tr:hover {
  background: var(--bg-secondary);
}

/* Status Badges */
.badge {
  display: inline-block;
  padding: 4px 12px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  border-radius: 12px;
  white-space: nowrap;
}

.badge-success {
  background: rgba(30, 142, 62, 0.1);
  color: var(--success);
}

.badge-danger {
  background: rgba(217, 48, 37, 0.1);
  color: var(--danger);
}

.badge-warning {
  background: rgba(249, 171, 0, 0.1);
  color: var(--warning);
}

.badge-info {
  background: rgba(26, 115, 232, 0.1);
  color: var(--primary);
}

/* FAB */
.fab {
  position: fixed;
  bottom: var(--spacing-lg);
  right: var(--spacing-lg);
  width: 56px;
  height: 56px;
  font-size: 2rem;
  line-height: 1;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  box-shadow: 0 4px 12px var(--shadow-md);
  cursor: pointer;
  z-index: 50;
  transition: all var(--transition);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.fab:hover {
  background: var(--primary-dark);
  box-shadow: 0 6px 16px var(--shadow-md);
}

.fab:active {
  transform: scale(0.95);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: var(--spacing-md);
}

.modal-content {
  background: var(--surface);
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px var(--shadow-md);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  width: 44px;
  height: 44px;
  font-size: 2rem;
  line-height: 1;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  transition: background var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

.modal-close:hover {
  background: var(--bg-secondary);
}

.modal-body {
  padding: var(--spacing-lg);
}

.modal-footer {
  display: flex;
  gap: var(--spacing-md);
  justify-content: flex-end;
  padding: var(--spacing-lg);
  border-top: 1px solid var(--border);
}

/* Error & Success Messages */
.error-msg {
  padding: var(--spacing-md);
  margin-top: var(--spacing-md);
  background: rgba(217, 48, 37, 0.1);
  color: var(--danger);
  border-radius: 8px;
  font-size: var(--font-size-sm);
  display: none;
}

.error-msg:not(:empty) {
  display: block;
}

.success-msg {
  padding: var(--spacing-md);
  margin-top: var(--spacing-md);
  background: rgba(30, 142, 62, 0.1);
  color: var(--success);
  border-radius: 8px;
  font-size: var(--font-size-sm);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--spacing-lg);
  box-shadow: 0 1px 3px var(--shadow);
}

.stat-value {
  font-size: var(--font-size-xxl);
  font-weight: 700;
  color: var(--primary);
  margin-bottom: var(--spacing-xs);
}

.stat-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

/* Form Grid */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-lg);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: var(--spacing-md);
  opacity: 0.3;
}

/* Mobile Adjustments */
@media (max-width: 767px) {
  :root {
    --header-height: 56px;
    --sidebar-width: 85vw;
    --spacing-lg: 1rem;
    --spacing-xl: 1.5rem;
  }
  
  .card {
    padding: var(--spacing-md);
    border-radius: 8px;
  }
  
  .container {
    padding: var(--spacing-md);
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  table {
    font-size: 0.8rem;
  }
  
  th, td {
    padding: 8px 12px;
  }
  
  .btn {
    padding: 10px 20px;
  }
  
  .modal-content {
    max-height: 95vh;
    margin: 0;
  }
}

@media (min-width: 768px) {
/* Loading Spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive logo adjustments */
@media (max-width: 768px) {
  
  
  }
}

@media (max-width: 480px) {
  
  
  }

/* Dark theme adjustments */
.dark-theme }

/* Responsive enhancements */
@media (max-width: 768px) {
  
  
  }
  
  }

@media (max-width: 480px) {
  
  
  }
}

/* Rounded Logo Placeholder Styles */
}

}

.logo-upload-area:hover {
  border-color: rgba(245, 185, 66, 0.8);
  background: linear-gradient(135deg, rgba(245, 185, 66, 0.15), rgba(245, 185, 66, 0.08));
  transform: translateY(-2px);
}

.upload-instructions {
  color: #F5B942;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  font-weight: 500;
}

/* Animation */
@keyframes logoGlow {
  0% { opacity: 0.3; transform: rotate(0deg) scale(1); }
  100% { opacity: 0.6; transform: rotate(180deg) scale(1.1); }
}

/* Dark theme enhancements */
.dark-theme }

.sidebar.collapsed {
  width: 60px; /* Much narrower */
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  min-height: 60px;
}

.sidebar-title {
  font-size: 1.2rem;
  margin: 0;
  transition: opacity 0.3s ease;
  white-space: nowrap;
}

.sidebar.collapsed .sidebar-title {
  opacity: 0;
  pointer-events: none;
  width: 0;
}

.sidebar-collapse {
  background: rgba(245, 185, 66, 0.1);
  border: 1px solid rgba(245, 185, 66, 0.3);
  color: #F5B942;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  position: absolute;
  right: 1rem;
  z-index: 100;
}

.sidebar.collapsed .sidebar-collapse {
  right: 50%;
  transform: translateX(50%);
}

.sidebar-collapse:hover {
  background: rgba(245, 185, 66, 0.2);
  border-color: rgba(245, 185, 66, 0.5);
  transform: scale(1.05);
}

.sidebar.collapsed .sidebar-collapse:hover {
  transform: translateX(50%) scale(1.05);
}

.collapse-icon {
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  display: inline-block;
  font-weight: bold;
}

.sidebar.collapsed .collapse-icon {
  transform: rotate(180deg);
}

/* Fixed Navigation Links with Icons */
.nav-list {
  padding: 0.5rem 0;
  list-style: none;
  margin: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
  margin: 0.25rem 0.5rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: visible;
}

.nav-icon {
  font-size: 1.3rem;
  margin-right: 0.75rem;
  min-width: 28px;
  text-align: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.nav-text {
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
  flex-grow: 1;
}

.sidebar.collapsed .nav-text {
  opacity: 0;
  transform: translateX(-20px);
  pointer-events: none;
  width: 0;
  overflow: hidden;
}

.sidebar.collapsed .nav-icon {
  margin-right: 0;
  font-size: 1.5rem;
  margin-left: 0;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 0.75rem 0.3rem;
  margin: 0.25rem 0.2rem;
}

/* Tooltip for collapsed state */
.sidebar.collapsed .nav-link::before {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 15px);
  top: 50%;
  transform: translateY(-50%);
  background: #2a2a2a;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.sidebar.collapsed .nav-link:hover::before {
  opacity: 1;
}

/* Active link styling */
.nav-link.active {
  background: linear-gradient(90deg, rgba(245, 185, 66, 0.15), rgba(245, 185, 66, 0.05));
  color: #F5B942;
  border-left: 3px solid #F5B942;
}

.sidebar.collapsed .nav-link.active {
  border-left: none;
  background: rgba(245, 185, 66, 0.2);
  border-radius: 8px;
}

/* Main content adjustment */
.main-content {
  margin-left: 250px;
  transition: margin-left 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  padding: 1rem;
}

.sidebar.collapsed + .main-content {
  margin-left: 60px; /* Adjusted for narrower sidebar */
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    width: 250px; /* Keep full width on mobile */
  }
  
  .main-content {
    margin-left: 0;
    padding: 1rem;
  }
  
  /* Hide collapse button on mobile, show close button */
  .sidebar-collapse {
    display: none;
  }
  
  .sidebar-close {
    display: flex;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
  }
}

/* Desktop: hide close button, show collapse button */
@media (min-width: 769px) {
  .sidebar-close {
    display: none;
  }
  
  .sidebar-collapse {
    display: flex;
  }
}

/* Minimal Login Logo Styles */
.login-logo {
  text-align: center;
  margin-bottom: 2rem;
  padding: 1rem;
}

.logo-image {
  max-width: 100%;
  height: auto;
  max-height: 80px;
  opacity: 0.9;
}

/* Dark theme login adjustments */
.dark-theme .logo-image {
  opacity: 0.8;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .logo-image {
    max-height: 60px;
  }
  
  .login-logo {
    padding: 0.5rem;
    margin-bottom: 1.5rem;
  }
}

/* Unified Sidebar Styles */
/* Unified Sidebar Styles */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 250px;
  height: 100vh;
  background: var(--surface, #2a2a2a);
  border-right: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  transition: width 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar.collapsed {
  width: 60px;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  position: relative;
  min-height: 60px;
}

.sidebar-title {
  font-size: 1.2rem;
  margin: 0;
  transition: opacity 0.3s ease;
  white-space: nowrap;
  color: var(--text);
}

.sidebar.collapsed .sidebar-title {
  opacity: 0;
  pointer-events: none;
  width: 0;
}

.sidebar-collapse {
  background: rgba(245, 185, 66, 0.1);
  border: 1px solid rgba(245, 185, 66, 0.3);
  color: #F5B942;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  position: absolute;
  right: 1rem;
  z-index: 100;
}

.sidebar.collapsed .sidebar-collapse {
  right: 50%;
  transform: translateX(50%);
}

.sidebar-collapse:hover {
  background: rgba(245, 185, 66, 0.2);
  border-color: rgba(245, 185, 66, 0.5);
  transform: scale(1.05);
}

.sidebar.collapsed .sidebar-collapse:hover {
  transform: translateX(50%) scale(1.05);
}

.collapse-icon {
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  display: inline-block;
  font-weight: bold;
}

.sidebar.collapsed .collapse-icon {
  transform: rotate(180deg);
}

/* Navigation Links */
.nav-list {
  padding: 0.5rem 0;
  list-style: none;
  margin: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
  margin: 0.25rem 0.5rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: visible;
}

.nav-icon {
  font-size: 1.3rem;
  margin-right: 0.75rem;
  min-width: 28px;
  text-align: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.nav-text {
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
  flex-grow: 1;
}

.sidebar.collapsed .nav-text {
  opacity: 0;
  transform: translateX(-20px);
  pointer-events: none;
  width: 0;
  overflow: hidden;
}

.sidebar.collapsed .nav-icon {
  margin-right: 0;
  font-size: 1.5rem;
  margin-left: 0;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 0.75rem 0.3rem;
  margin: 0.25rem 0.2rem;
}

/* Tooltip for collapsed state */
.sidebar.collapsed .nav-link::before {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 15px);
  top: 50%;
  transform: translateY(-50%);
  background: #2a2a2a;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.sidebar.collapsed .nav-link:hover::before {
  opacity: 1;
}

/* Active link styling */
.nav-link.active {
  background: linear-gradient(90deg, rgba(245, 185, 66, 0.15), rgba(245, 185, 66, 0.05));
  color: #F5B942;
  border-left: 3px solid #F5B942;
}

.sidebar.collapsed .nav-link.active {
  border-left: none;
  background: rgba(245, 185, 66, 0.2);
  border-radius: 8px;
}

/* Main content adjustment */
.main-content {
  margin-left: 250px;
  margin-top: var(--header-height);
  padding: 1.5rem;
  transition: margin-left 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  min-height: calc(100vh - var(--header-height));
}

.sidebar.collapsed + .main-content {
  margin-left: 60px;
}

/* Mobile responsive - traditional slide-out */
@media (max-width: 768px) {
  .sidebar {
    left: -250px;
    width: 250px !important; /* Force full width on mobile */
  }
  
  .sidebar.open {
    left: 0;
  }
  
  .main-content {
    margin-left: 0;
    padding: 1rem;
  }
  
  .sidebar.collapsed + .main-content {
    margin-left: 0;
  }
  
  /* Hide collapse button on mobile, show close button */
  .sidebar-collapse {
    display: none;
  }
  
  .sidebar-close {
    display: flex;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
  }
}

/* Desktop: hide close button, show collapse button */
@media (min-width: 769px) {
  .sidebar-close {
    display: none;
  }
  
  .sidebar-collapse {
    display: flex;
  }
}

/* Enhanced Mobile Navigation */
@media (max-width: 768px) {
  /* Ensure hamburger menu is visible and accessible */
  .menu-toggle {
    display: flex !important;
    background: rgba(245, 185, 66, 0.1);
    border: 1px solid rgba(245, 185, 66, 0.3);
    border-radius: 6px;
    padding: 0.4rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 36px; /* Compact but touch-friendly size */
    height: 36px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* Prevent shrinking */
  }
  
  .menu-toggle:hover,
  .menu-toggle:active {
    background: rgba(245, 185, 66, 0.2);
    border-color: rgba(245, 185, 66, 0.5);
    transform: scale(1.05);
  }
  
  .menu-toggle span {
    width: 18px;
    height: 2px;
    background: #F5B942;
    border-radius: 1px;
    margin: 2px 0;
    transition: all 0.3s ease;
  }
  
  /* Animated hamburger */
  .menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  
  .menu-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  
  .menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }
  
  /* Header mobile adjustments */
  .header {
    padding: 0.75rem 1rem;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(245, 185, 66, 0.2);
  }
  
  .header-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #F5B942;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
  
  /* Theme toggle mobile */
  .theme-toggle {
    background: rgba(245, 185, 66, 0.1);
    border: 1px solid rgba(245, 185, 66, 0.3);
    border-radius: 6px;
    padding: 0.4rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  
  /* Mobile sidebar enhancements */
  .sidebar {
    backdrop-filter: blur(16px);
    background: rgba(42, 42, 42, 0.95);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
  }
  
  .sidebar.open {
    left: 0 !important;
  }
  
  /* Mobile content padding */
  .main-content {
    padding: 1rem 0.75rem;
  }
  
  /* Add overlay for open sidebar */
  .sidebar.open::after {
    content: '';
    position: fixed;
    top: 0;
    right: -100vw;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
  }
}

/* Enhanced touch targets for mobile */
@media (max-width: 768px) and (pointer: coarse) {
  .nav-link {
    padding: 1rem;
    margin: 0.5rem;
    min-height: 48px;
    font-size: 1.1rem;
  }
  
  .nav-icon {
    font-size: 1.5rem;
    margin-right: 1rem;
  }
  
  .sidebar-close {
    min-width: 48px;
    min-height: 48px;
    font-size: 1.5rem;
  }
}

/* Mobile viewport and scrolling fixes */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
  
  html {
    overflow-x: hidden;
  }
  
  /* Prevent content from going under mobile browser bars */
  .main-content {
    padding-bottom: env(safe-area-inset-bottom, 2rem);
    padding-top: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  }
  
  /* Header safe area */
  .header {
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  }
  
  /* Fix orange browser chrome */
  .header {
    background: #2a2a2a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
}

/* Dark theme mobile enhancements */
.dark-theme .header {
  background: #1a1a1a;
}

.dark-theme .sidebar {
  background: rgba(26, 26, 26, 0.95);
}

/* Always center header title on mobile */
@media (max-width: 768px) {
  .header .header-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1rem;
    font-weight: 600;
  }
}

/* Center header title on desktop when sidebar is collapsed */
@media (min-width: 769px) {
  .header.center-title .header-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }
}
