/* ========================================
   Employee Portal - Presto Design System
   Mobile-First HR System
   ======================================== */

/* === 1. CSS Variables === */
:root {
  /* Presto Colors */
  --presto-primary: #FF4E02;
  --presto-primary-50: #FFF4ED;
  --presto-primary-100: #FFE6D6;
  --presto-primary-600: #E64502;
  --presto-primary-700: #CC3D02;
  
  /* Status Colors */
  --presto-success: #10b981;
  --presto-success-50: #ecfdf5;
  --presto-danger: #ef4444;
  --presto-danger-50: #fef2f2;
  --presto-warning: #f59e0b;
  --presto-warning-50: #fffbeb;
  --presto-info: #0ea5e9;
  --presto-info-50: #e0f2fe;
  
  /* Grays */
  --presto-gray-50: #f9fafb;
  --presto-gray-100: #f3f4f6;
  --presto-gray-200: #e5e7eb;
  --presto-gray-300: #d1d5db;
  --presto-gray-400: #9ca3af;
  --presto-gray-500: #6b7280;
  --presto-gray-600: #4b5563;
  --presto-gray-700: #374151;
  --presto-gray-800: #1f2937;
  --presto-gray-900: #111827;
  
  /* Semantic Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-elevated: #ffffff;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --border-primary: #e5e7eb;
  --border-secondary: #f3f4f6;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
  
  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;
}

/* Dark Mode Variables */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-elevated: #1f2937;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-tertiary: #9ca3af;
    --border-primary: #374151;
    --border-secondary: #1f2937;
  }
}

/* === 2. Base Styles === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  direction: rtl;
}

/* === 3. Layout === */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-md);
}

.container-sm {
  max-width: 480px;
}

.container-md {
  max-width: 768px;
}

/* === 4. Mobile Navigation === */
.mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-primary);
  box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
  padding: var(--spacing-sm) 0;
  z-index: 1000;
  display: none;
}

.mobile-nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 600px;
  margin: 0 auto;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--spacing-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12px;
  transition: var(--transition-fast);
  position: relative;
}

.mobile-nav-item:active {
  transform: scale(0.95);
}

.mobile-nav-item.active {
  color: var(--presto-primary);
}

.mobile-nav-item .icon {
  font-size: 24px;
}

.mobile-nav-item .badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--presto-danger);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  font-weight: 600;
  min-width: 18px;
  text-align: center;
}

@media (max-width: 768px) {
  .mobile-nav {
    display: block;
  }
  
  body {
    padding-bottom: 80px; /* Space for fixed nav */
  }
}

/* === 5. Cards === */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

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

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  font-size: 14px;
  color: var(--text-secondary);
}

/* === 6. Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: translateY(1px);
}

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

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

.btn-primary:active {
  background: var(--presto-primary-700);
}

.btn-secondary {
  background: var(--presto-gray-100);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--presto-gray-200);
}

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

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

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

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-primary);
  color: var(--text-primary);
}

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

.btn-lg {
  padding: 16px 32px;
  font-size: 16px;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* === 7. Forms === */
.form-group {
  margin-bottom: var(--spacing-lg);
}

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

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text-primary);
  transition: var(--transition-fast);
  font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--presto-primary);
  box-shadow: 0 0 0 3px var(--presto-primary-50);
}

.form-input::placeholder {
  color: var(--text-tertiary);
}

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

.form-error {
  color: var(--presto-danger);
  font-size: 13px;
  margin-top: var(--spacing-xs);
}

.form-hint {
  color: var(--text-tertiary);
  font-size: 13px;
  margin-top: var(--spacing-xs);
}

/* === 8. Stats Cards === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.stat-card {
  background: linear-gradient(135deg, var(--presto-primary) 0%, var(--presto-primary-600) 100%);
  color: white;
  padding: var(--spacing-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.stat-card.success {
  background: linear-gradient(135deg, var(--presto-success) 0%, #059669 100%);
}

.stat-card.warning {
  background: linear-gradient(135deg, var(--presto-warning) 0%, #d97706 100%);
}

.stat-card.info {
  background: linear-gradient(135deg, var(--presto-info) 0%, #0284c7 100%);
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  opacity: 0.9;
}

/* === 9. List Items === */
.list {
  list-style: none;
}

.list-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition-fast);
}

.list-item:active {
  transform: scale(0.98);
  background: var(--bg-secondary);
}

.list-item-content {
  flex: 1;
}

.list-item-title {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.list-item-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

.list-item-action {
  color: var(--presto-primary);
  font-size: 20px;
}

/* === 10. Badges === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-primary {
  background: var(--presto-primary-50);
  color: var(--presto-primary-700);
}

.badge-success {
  background: var(--presto-success-50);
  color: #065f46;
}

.badge-warning {
  background: var(--presto-warning-50);
  color: #92400e;
}

.badge-danger {
  background: var(--presto-danger-50);
  color: #991b1b;
}

.badge-info {
  background: var(--presto-info-50);
  color: #075985;
}

/* === 11. Loading Spinner === */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-primary);
  border-top-color: var(--presto-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: var(--spacing-lg) auto;
}

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

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

/* === 12. Alerts === */
.alert {
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
}

.alert-success {
  background: var(--presto-success-50);
  color: #065f46;
  border: 1px solid #bbf7d0;
}

.alert-warning {
  background: var(--presto-warning-50);
  color: #92400e;
  border: 1px solid #fde68a;
}

.alert-danger {
  background: var(--presto-danger-50);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-info {
  background: var(--presto-info-50);
  color: #075985;
  border: 1px solid #bae6fd;
}

/* === 13. Avatar === */
.avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--presto-primary-100);
  color: var(--presto-primary-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 18px;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 14px;
}

.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 24px;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-full);
}

/* === 14. Utility Classes === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--spacing-xs); }
.gap-2 { gap: var(--spacing-sm); }
.gap-3 { gap: var(--spacing-md); }

.hidden { display: none; }

@media (max-width: 768px) {
  .hidden-mobile { display: none; }
}

@media (min-width: 769px) {
  .hidden-desktop { display: none; }
}

/* === 15. Responsive === */
@media (max-width: 768px) {
  .container {
    padding: var(--spacing-sm);
  }
  
  .card {
    padding: var(--spacing-md);
  }
  
  .stat-value {
    font-size: 24px;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
  }
}
