/* ========================================
   GLOBAL STYLES
   ======================================== */
@import url('./variables.css');

/* ========================================
   BASE RESET & DEFAULTS
   ======================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Prevent white flash during page transitions */
  background-color: var(--bg-primary);
}

body {
  background: var(--main-bg);
  color: var(--text-white);
  font-family: 'Poppins', Arial, sans-serif;
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.5;
  min-height: 100vh;
  /* ⚡ PERFORMANCE: Transitions disabled - causes fade-in animation */
  /* transition: opacity 0.15s ease-out; */
}

/* Page transition states for smooth navigation */
body.page-loading {
  opacity: 0.95;
}

body.page-loaded {
  opacity: 1;
}

/* Alpine.js x-cloak directive */
[x-cloak] {
  display: none !important;
}

/* ⚡ PERFORMANCE: Disable ALL animations during page load */
.preload * {
  -webkit-transition: none !important;
  -moz-transition: none !important;
  -ms-transition: none !important;
  -o-transition: none !important;
  transition: none !important;
  animation: none !important;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--text-white);
  line-height: 1.2;
}

h1 {
  font-size: 1.625rem;
  margin-bottom: var(--spacing-md);
}

h2 {
  font-size: 1.375rem;
  margin-bottom: var(--spacing-md);
}

h3 {
  font-size: 1.25rem;
  margin-bottom: var(--spacing-sm);
}

h4 {
  font-size: 1.125rem;
  margin-bottom: var(--spacing-sm);
}

p {
  margin-bottom: var(--spacing-md);
}

a {
  color: var(--light-purple);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--badge-bg-hover);
}

/* Font utilities */
.font-thin {
  font-family: 'Poppins', Arial, sans-serif;
  font-weight: 300;
  font-size: 1rem;
  letter-spacing: 0.01em;
}

.font-poppins {
  font-family: 'Poppins', 'Segoe UI', Arial, sans-serif;
}

/* Font size utilities */
.fs-2 { font-size: 2rem; }
.fs-1-5 { font-size: 1.625rem; }
.fs-1-3 { font-size: 1.375rem; }
.fs-1-15 { font-size: 1.25rem; }
.fs-1 { font-size: 1.125rem; }
.fs-0-9 { font-size: 1rem; }
.fs-0-85 { font-size: 0.85rem; }
.fs-0-8 { font-size: 0.9rem; }
.fs-0-7 { font-size: 0.8rem; }

/* Text color utilities */
.text-white {
  color: var(--text-white) !important;
}

.text-gray {
  color: var(--text-gray) !important;
}

.text-purple {
  color: var(--light-purple) !important;
}

/* ========================================
   LAYOUT
   ======================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex-grow: 1;
  padding: 30px;
  height: 100vh;
  overflow-y: auto;
  box-sizing: border-box;
  margin-left: 240px;
  position: relative;
  transition: opacity 0.15s ease;
}

/* Content loading state */
.main-content.loading {
  opacity: 0.7;
}

/* Page transition overlay */
.page-transition-overlay {
  position: fixed;
  top: 0;
  left: 240px; /* Start after sidebar */
  right: 0;
  bottom: 0;
  background: var(--main-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.page-transition-overlay.show {
  opacity: 0.95;
  visibility: visible;
}

.page-transition-overlay .loading-content {
  text-align: center;
  color: var(--text-gray);
}

.page-transition-overlay .loading-content .spinner {
  margin-bottom: 16px;
}

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

.container-center {
  max-width: 1200px;
  margin: 0 auto;
}

.max-w-800 {
  max-width: 800px;
}

.max-w-1400 {
  max-width: 1400px;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.align-items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }

/* Margin utilities */
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mb-48 { margin-bottom: 48px; }

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }

/* Padding utilities */
.p-8 { padding: 8px; }
.p-16 { padding: 16px; }
.p-24 { padding: 24px; }
.p-32 { padding: 32px; }

.p-8-8 { padding: 8px; }
.px-16 { padding-left: 16px; padding-right: 16px; }
.py-16 { padding-top: 16px; padding-bottom: 16px; }

/* Display utilities */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Border radius */
.rounded { border-radius: var(--border-radius); }
.rounded-sm { border-radius: var(--border-radius-sm); }
.rounded-lg { border-radius: var(--border-radius-lg); }

/* Shadows */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* ========================================
   RESPONSIVE - DESKTOP FIRST
   ======================================== */

/* Desktop: Sidebar always visible */
.sidebar {
  transform: translateX(0);
  transition: none;
}

/* Desktop: Hide mobile-only elements */
.hamburger-btn,
.sidebar-overlay {
  display: none;
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  .main-content {
    margin-left: 0;
    padding: 80px 16px 24px 16px; /* Top padding for hamburger */
  }
  
  .container {
    padding: 0 var(--spacing-sm);
  }
  
  /* ========================================
     MOBILE NAVIGATION - HAMBURGER MENU
     ======================================== */
  
  /* Mobile sidebar: hide by default, slide in when open */
  .sidebar {
    transform: translateX(-100%) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3001 !important; /* Higher than overlay */
    display: flex !important; /* Override any display: none */
    background: #171820 !important; /* Force dark background */
  }
  
  .sidebar.open,
  .sidebar.active {
    transform: translateX(0) !important;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
  }
  
  /* Overlay when sidebar is open - show on mobile */
  .sidebar-overlay {
    display: block !important; /* Override desktop display: none */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 3000; /* Below sidebar (3001) but above everything else */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }
  
  .sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }
  
  /* Hamburger button - show on mobile */
  .hamburger-btn {
    display: flex; /* Override desktop display: none */
    position: fixed;
    top: 16px;
    left: 16px;
    width: 44px;
    height: 44px;
    background: var(--card-bg);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    z-index: 1001;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  }
  
  .hamburger-btn:hover {
    background: var(--table-hover-bg);
  }
  
  .hamburger-btn:active {
    transform: scale(0.95);
  }
  
  .hamburger-line {
    width: 22px;
    height: 2px;
    background: var(--text-white);
    transition: all 0.3s ease;
    border-radius: 2px;
  }
  
  .hamburger-btn.open .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  
  .hamburger-btn.open .hamburger-line:nth-child(2) {
    opacity: 0;
  }
  
  .hamburger-btn.open .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
  
  /* ========================================
     MOBILE NAVIGATION - NOTIFICATIONS
     ======================================== */
  
  #notification-dropdown {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 360px;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1002;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    background: var(--main-bg);
  }
  
  #notification-dropdown.open {
    transform: translateX(0);
  }
  
  .notification-item {
    padding: 16px;
    min-height: 80px;
    border-bottom: 1px solid var(--border-dark);
    cursor: pointer;
    transition: background 0.2s ease;
  }
  
  .notification-item:active {
    background: var(--table-hover-bg);
  }
  
  /* ========================================
     MOBILE SIDEBAR - ENSURE VISIBILITY
     ======================================== */
  
  /* Make sure sidebar content is visible on mobile */
  .sidebar .sidebar-title {
    display: flex !important;
    color: #FFFFFF;
  }
  
  .sidebar .close-menu {
    display: block !important;
    color: #FFFFFF;
  }
  
  /* Company selector in sidebar */
  .sidebar .company-selector {
    display: block !important;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #2B2A32;
  }
  
  .sidebar .company-btn {
    display: flex !important;
    width: 100%;
    align-items: center;
    gap: 12px;
    /* Styling inherited from components.css */
  }
  
  /* Ensure sidebar menu items are visible with proper spacing */
  .sidebar .sidebar-menu {
    display: flex !important;
    flex-direction: column;
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
  }
  
  .sidebar .sidebar-menu a {
    display: flex !important;
    align-items: center;
    gap: 16px;
    min-height: 48px;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    /* Colors inherited from style.css */
  }
  
  /* Sidebar footer (notifications & logout) */
  .sidebar .sidebar-footer {
    display: flex !important;
    flex-direction: column;
    gap: 0;
    margin-top: auto;
    padding: 0;
    border-top: 1px solid #2B2A32;
  }
  
  .sidebar .notification-bell-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    width: 100%;
    padding: 16px;
    background: none;
    border: none;
    position: relative;
    cursor: pointer;
    /* Colors inherited from notifications.css */
  }
  
  .sidebar .logout-link {
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    min-height: 48px;
    padding: 12px 16px;
    width: 100%;
    text-decoration: none;
    border-radius: 6px;
    /* Colors inherited from notifications.css */
  }
  
  /* ========================================
     MOBILE - TOUCH TARGETS
     ======================================== */
  
  .btn,
  button,
  a.clickable,
  .action-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 16px;
  }
  
  /* ========================================
     MOBILE - RESPONSIVE TYPOGRAPHY
     ======================================== */
  
  h1 {
    font-size: 1.5rem;
  }
  
  h2 {
    font-size: 1.25rem;
  }
  
  h3 {
    font-size: 1.1rem;
  }
  
  body {
    font-size: 1rem;
    line-height: 1.5;
  }
} 