/* =========================================================
   SALARY & ATTENDANCE MANAGEMENT SYSTEM - MAIN STYLES
   Designed for Mobile, Tablet, and Desktop / Laptop
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Color Palette - Vibrant Dark / Indigo Emerald */
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(31, 41, 55, 0.85);
  --bg-glass: rgba(17, 24, 39, 0.85);
  --bg-input: #1f2937;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);

  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --text-inverse: #0b0f19;

  /* Brand Accents */
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --primary-light: #818cf8;
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.25);
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-cyan: #06b6d4;
  --accent-purple: #8b5cf6;

  /* Status Colors */
  --status-present: #10b981;
  --status-present-bg: rgba(16, 185, 129, 0.15);
  --status-halfday: #f59e0b;
  --status-halfday-bg: rgba(245, 158, 11, 0.15);
  --status-absent: #f43f5e;
  --status-absent-bg: rgba(244, 63, 94, 0.15);
  --status-manual: #8b5cf6;
  --status-manual-bg: rgba(139, 92, 246, 0.15);
  --status-advance: #3b82f6;
  --status-advance-bg: rgba(59, 130, 246, 0.15);

  /* Shadows & Glassmorphism */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px var(--primary-glow);
  --shadow-emerald: 0 0 20px var(--accent-emerald-glow);
  --backdrop-blur: blur(16px);

  /* Layout & Sizing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --sidebar-width: 260px;
  --header-height: 60px;
  --bottom-nav-height: 60px;
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-primary: #f3f4f6;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: rgba(249, 250, 251, 0.98);
  --bg-glass: rgba(255, 255, 255, 0.9);
  --bg-input: #f3f4f6;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);

  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --text-inverse: #ffffff;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 8px 20px rgba(99, 102, 241, 0.2);
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Ambient background */
body::before {
  content: '';
  position: fixed;
  top: -10vw;
  right: -5vw;
  width: 40vw;
  height: 40vw;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, rgba(99, 102, 241, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: -10vw;
  left: -5vw;
  width: 35vw;
  height: 35vw;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

/* App Container Layout */
#app {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  position: relative;
  z-index: 1;
  overflow-x: hidden;
}

/* Mobile Sidebar Backdrop Overlay */
.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 45;
  display: none !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.sidebar-backdrop.active {
  display: block !important;
  opacity: 1;
  pointer-events: auto;
}

/* Sidebar for Desktop & Mobile Drawer */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-card);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  padding: 1.25rem 1rem;
  transition: transform var(--transition-normal);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.5rem 1.25rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.3rem;
  box-shadow: var(--shadow-glow);
}

.brand-info h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 40%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .brand-info h1 {
  background: linear-gradient(135deg, #111827 40%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-info p {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Navigation Links */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
  list-style: none;
}

.nav-item-btn {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.nav-item-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  transform: translateX(3px);
}

.nav-item-btn.active {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: var(--shadow-glow);
  border-color: rgba(255, 255, 255, 0.15);
}

.nav-item-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.15);
}

.sidebar-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  width: calc(100% - var(--sidebar-width));
  max-width: 100%;
  display: flex;
  flex-direction: column;
  background: transparent;
  position: relative;
  padding-bottom: 2rem;
  overflow-x: hidden;
}

/* Top App Header */
.app-header {
  height: var(--header-height);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-glass);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  max-width: 100%;
  gap: 0.5rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  flex: 1;
}

.mobile-menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
}

.page-title-area {
  min-width: 0;
  overflow: hidden;
}

.page-title-area h2 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* Content Container */
.content-container {
  padding: 1.25rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  overflow-x: hidden;
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-secondary);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border-top: 1px solid var(--border-color);
  z-index: 40;
  justify-content: space-around;
  align-items: center;
  padding: 0 0.25rem;
  padding-bottom: env(safe-area-inset-bottom, 0);
  width: 100%;
  max-width: 100%;
}

.bottom-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  flex: 1;
}

.bottom-nav-btn svg {
  width: 20px;
  height: 20px;
}

.bottom-nav-btn.active {
  color: var(--primary-light);
}

.bottom-nav-btn.active svg {
  color: var(--primary);
  filter: drop-shadow(0 2px 6px var(--primary-glow));
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 220px;
  }
}

@media (max-width: 820px) {
  .app-sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
    padding-bottom: calc(var(--bottom-nav-height) + 1rem);
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .mobile-bottom-nav {
    display: flex;
  }

  .content-container {
    padding: 0.75rem;
  }
  
  .app-header {
    height: 54px;
    padding: 0 0.65rem;
  }

  .page-title-area h2 {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .btn-add-text {
    display: none;
  }
  .app-header .btn-sm {
    padding: 0.35rem 0.6rem;
    font-size: 0.78rem;
  }
  .app-header .btn-icon {
    width: 32px;
    height: 32px;
  }
}
