/* Main CSS for both apps */
:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --secondary: #64748b;
  --accent: #f59e0b;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --dark: #1e293b;
  --light: #f8fafc;
  --border: #e2e8f0;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

* {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

input, textarea, [contenteditable="true"] {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  line-height: 1.6;
  scroll-behavior: smooth;
}

.landing-page {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

.brand-logo {
  color: white;
}

.brand-title {
  font-size: 3rem;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(45deg, #fff, #e2e8f0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-subtitle {
  font-size: 1.2rem;
  opacity: 0.9;
  margin-top: 0.5rem;
}

.app-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 2rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.app-card:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.app-card h4 {
  font-weight: 600;
  margin: 1rem 0 0.5rem 0;
}

.app-card p {
  opacity: 0.8;
  margin: 0;
  font-size: 0.9rem;
}

/* Mobile App Styles */
.mobile-app {
  max-width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--light);
  position: relative;
  overflow-x: hidden;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 1rem;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1030;
  box-shadow: var(--shadow-lg);
}

.app-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.app-content {
  padding-top: 80px;
  padding-bottom: 80px;
}

/* Side Navigation */
.side-nav {
  position: fixed;
  top: 0;
  left: -300px;
  width: 280px;
  height: 100vh;
  background: white;
  box-shadow: var(--shadow-lg);
  transition: left 0.3s ease;
  z-index: 1040;
  overflow-y: auto;
  overflow-x: hidden;
}

.side-nav.active {
  left: 0;
}

.side-nav::-webkit-scrollbar {
  width: 6px;
}

.side-nav::-webkit-scrollbar-track {
  background: transparent;
}

.side-nav::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.side-nav::-webkit-scrollbar-thumb:hover {
  background: var(--secondary);
}

.nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1035;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.nav-overlay.active {
  opacity: 1;
  visibility: visible;
}

.nav-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 2rem 1rem;
  text-align: center;
}

.nav-brand {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.nav-menu {
  padding: 1rem 0;
}

.nav-item {
  display: block;
  padding: 1rem 1.5rem;
  color: var(--dark);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: all 0.3s ease;
}

.nav-item:hover, .nav-item.active {
  background: var(--primary);
  color: white;
}

.nav-item i {
  width: 20px;
  margin-right: 1rem;
}

/* Cards */
.card {
  border: none;
  border-radius: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  overflow: hidden;
}

.card-header {
  background: var(--light);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  font-weight: 600;
}

.card-body {
  padding: 1.5rem;
}

/* Buttons */
.btn {
  border-radius: 12px;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border: none;
  transition: all 0.3s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: var(--shadow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-outline-primary {
  border: 2px solid var(--primary);
  color: var(--primary);
}

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

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

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

/* Forms */
.form-control {
  border-radius: 12px;
  border: 2px solid var(--border);
  padding: 0.75rem 1rem;
  transition: all 0.3s ease;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
}

.form-label {
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 0.5rem;
}

/* Status Badges */
.status-badge {
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
}

.status-present {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.status-absent {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

.status-late {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

/* Animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-in {
  animation: slideIn 0.5s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: white;
  border-top: 1px solid var(--border);
  padding: 0.5rem 0;
  z-index: 1030;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem;
  color: var(--secondary);
  text-decoration: none;
  font-size: 0.75rem;
  transition: color 0.3s ease;
}

.bottom-nav-item.active,
.bottom-nav-item:hover {
  color: var(--primary);
}

.bottom-nav-item i {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

/* Splash Screen */
.splash-screen {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  overflow-x: hidden;
}

.splash-slide {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.splash-icon {
  font-size: 5rem;
  margin-bottom: 2rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

.splash-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.splash-subtitle {
  font-size: 1.2rem;
  opacity: 0.9;
  margin-bottom: 2rem;
}

/* Loading Animation */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 2rem auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Desktop Layout (≥768px) */
@media (min-width: 768px) {
  .mobile-app {
    display: flex;
  }

  .side-nav {
    left: 0;
    position: fixed;
    width: 280px;
    z-index: 1000;
  }

  .nav-overlay {
    display: none !important;
  }

  .app-header {
    left: 280px;
    width: calc(100% - 280px);
  }

  .app-header .menu-toggle {
    display: none !important;
  }

  .app-content {
    margin-left: 280px;
    padding-top: 80px;
    padding-bottom: 2rem;
    max-width: 1400px;
    width: calc(100% - 280px);
  }

  .bottom-nav {
    display: none !important;
  }

  .card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  /*.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  }*/

  .row.g-3 {
    row-gap: 1.5rem !important;
  }

  .app-header h1 {
    font-size: 1.5rem;
  }

  body {
    background: var(--light);
  }

  .nav-item {
    border-radius: 8px;
    margin: 0.25rem 0.75rem;
    border-bottom: none;
  }

  .side-nav {
    border-right: 1px solid var(--border);
  }
}

/* Desktop Grid Improvements */
@media (min-width: 768px) {
  .desktop-stats-grid .col-6 {
    flex: 0 0 auto;
    width: 25%;
  }

  .desktop-quick-actions .col-6 {
    flex: 0 0 auto;
    width: 25%;
  }
}

/* Large Desktop (≥1200px) */
@media (min-width: 1200px) {
  .app-content {
    padding-left: 3rem;
    padding-right: 3rem;
  }

  .side-nav {
    width: 300px;
  }

  .app-header {
    left: 300px;
    width: calc(100% - 300px);
  }

  .app-content {
    margin-left: 300px;
    width: calc(100% - 300px);
  }

  .app-header h1 {
    font-size: 1.75rem;
  }
}

/* Tablet Portrait (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
  .app-content {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

/* Mobile Styles */
@media (max-width: 767px) {
  .app-header {
    padding: 0.75rem 1rem;
  }

  .app-content {
    padding-top: 70px;
    width: 100%;
  }

  .card-body {
    padding: 1rem;
  }
}

@media (max-width: 576px) {
  .splash-title {
    font-size: 2rem;
  }

  .splash-subtitle {
    font-size: 1rem;
  }
}

/* Dropdown Menu Fixes */
.dropdown-menu {
  position: absolute !important;
  z-index: 1050;
  min-width: 200px;
  max-height: none !important;
  overflow: visible !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 0.5rem;
}

.dropdown-menu.show {
  display: block !important;
}

.dropdown {
  position: relative;
}

.card .dropdown-menu {
  right: 0;
  left: auto;
  transform-origin: top right;
}

.dropdown-item {
  padding: 0.75rem 1rem;
  transition: all 0.2s ease;
}

.dropdown-item:hover {
  background-color: var(--light);
}

.dropdown-item i {
  width: 20px;
}

/* Ensure card doesn't clip dropdown */
.card {
  overflow: visible !important;
}

.card-body {
  overflow: visible !important;
}

/* Print Styles */
@media print {
  .app-header,
  .bottom-nav,
  .side-nav {
    display: none !important;
  }

  .app-content {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
}

/* PWA Specific Styles */
.pwa-install-prompt {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 1rem;
  max-width: 350px;
  width: 90%;
  z-index: 1025;
  border: 1px solid var(--border);
}

.pwa-install-prompt.hidden {
  display: none;
}

/* Enhanced Touch Interactions */
.btn, .card, .nav-item {
  -webkit-tap-highlight-color: transparent;
}

.btn:active, .card:active, .nav-item:active {
  /*transform: scale(0.98);*/
}

/* Improved Scrolling */
.app-content {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    margin-top: 70px;
    margin-bottom: 60px;
}

/* Status Badge Enhancements */
.status-weekly-off {
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
}

/* Calendar Enhancements */
.calendar-day.weekly-off {
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
}

/* Loading States */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-overlay.hidden {
  display: none;
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
  .theme-auto {
    --light: #1e293b;
    --dark: #f8fafc;
    --border: #374151;
  }
  
  .theme-auto .mobile-app {
    background: #1e293b;
    color: #f8fafc;
  }
  
  .theme-auto .card {
    background: #374151;
    color: #f8fafc;
  }
}

.theme-dark {
  --light: #1e293b;
  --dark: #f8fafc;
  --border: #374151;
}

.theme-dark .mobile-app {
  background: #1e293b;
  color: #f8fafc;
}

.theme-dark .card {
  background: #374151;
  color: #f8fafc;
}

.theme-dark .form-control {
  background: #1e293b;
  border-color: #374151;
  color: #f8fafc;
}

.theme-dark .form-control:focus {
  background: #1e293b;
  border-color: var(--primary);
  color: #f8fafc;