/* ========================================
   TIMETRACK PRO - STYLES
   ======================================== */

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #ec4899;
  --success: #10b981;
  --success-light: #34d399;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --glass: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.3);
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 8px;
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-family);
  background: var(--bg-gradient);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
  color: #1f2937;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.container {
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 30px 25px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow);
  margin-top: 10px;
  margin-bottom: 20px;
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 30px;
}

.logo {
  width: 80px;
  height: 80px;
  background: var(--bg-gradient);
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  color: white;
  box-shadow: 0 12px 24px rgba(79, 70, 229, 0.3);
  position: relative;
  overflow: hidden;
}

.logo::after {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.2), transparent);
}

.logo svg {
  stroke: white;
  width: 44px;
  height: 44px;
}

h1 {
  color: #111827;
  font-size: 28px;
  margin-bottom: 6px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.subtitle {
  color: #6b7280;
  font-size: 15px;
  font-weight: 500;
}

/* Toggle Container */
.toggle-container {
  display: flex;
  background: rgba(0,0,0,0.05);
  border-radius: 14px;
  padding: 5px;
  margin-bottom: 30px;
}

.toggle-btn {
  flex: 1;
  padding: 12px 8px;
  border: none;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: #6b7280;
}

.toggle-btn.active {
  background: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  color: var(--primary);
}

/* Mode Indicators */
.mode-indicator {
  background: #e0e7ff;
  color: #4338ca;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 25px;
  width: 100%;
}

.mode-indicator.setup {
  background: #fef3c7;
  color: #b45309;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
}

label {
  display: block;
  color: #555;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input, select {
  width: 100%;
  padding: 14px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-size: 16px;
  transition: all 0.3s;
  font-family: inherit;
  background: #fafafa;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* Buttons */
.btn {
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--bg-gradient);
  color: white;
  box-shadow: 0 8px 16px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 12px 20px rgba(79, 70, 229, 0.3);
}

.btn-success {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: white;
  box-shadow: 0 8px 16px rgba(16, 185, 129, 0.25);
  font-size: 16px;
  padding: 18px;
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  color: white;
  box-shadow: 0 8px 16px rgba(239, 68, 68, 0.25);
  font-size: 16px;
  padding: 18px;
}

.btn-pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* GPS Elements */
.gps-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #e3f2fd;
  border-radius: 10px;
  margin-bottom: 15px;
  font-size: 14px;
  color: #1565c0;
  border-left: 4px solid #2196f3;
}

.gps-status.active {
  background: #e8f5e9;
  color: #2e7d32;
  border-left-color: #4caf50;
}

.gps-status.error {
  background: #ffebee;
  color: #c62828;
  border-left-color: #f44336;
}

.gps-details {
  margin-bottom: 20px;
  padding: 15px;
  background: #f5f5f5;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  color: #555;
}

.gps-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  background: #fff3e0;
  border-radius: 10px;
  margin-bottom: 15px;
  font-size: 13px;
  color: #e65100;
  animation: fadeIn 0.3s;
}

.distance-container {
  text-align: center;
  margin-bottom: 20px;
  animation: fadeIn 0.5s;
}

.distance-badge {
  background: var(--primary);
  color: white;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  display: inline-block;
  margin-bottom: 8px;
  box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
  transition: all 0.3s;
}

.distance-badge.near {
  background: var(--success);
  box-shadow: 0 4px 10px rgba(17, 153, 142, 0.3);
}

.distance-badge.far {
  background: var(--danger);
  box-shadow: 0 4px 10px rgba(235, 51, 73, 0.3);
}

.distance-hint {
  font-size: 12px;
  color: #888;
  margin: 0;
}

/* Status Card */
.status-card {
  background: var(--bg-gradient);
  color: white;
  padding: 30px 20px;
  border-radius: var(--radius-lg);
  text-align: center;
  margin-bottom: 25px;
  box-shadow: 0 15px 30px rgba(79, 70, 229, 0.2);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.status-card.working {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 15px 30px rgba(16, 185, 129, 0.2);
}

.status-icon {
  font-size: 44px;
  margin-bottom: 12px;
}

.status-text {
  font-size: 16px;
  font-weight: 500;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.status-time {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -1px;
}

/* Last Action */
.last-action {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 12px;
  margin-bottom: 20px;
  text-align: center;
  border: 2px dashed #e0e0e0;
}

.last-action-label {
  color: #888;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 5px;
}

.last-action-time {
  color: #333;
  font-size: 16px;
  font-weight: 700;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: #f8f9fa;
  padding: 18px 10px;
  border-radius: 12px;
  text-align: center;
  border: 2px solid transparent;
  transition: all 0.3s;
}

.stat-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 5px;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* Entries List */
.entries-section {
  margin-bottom: 30px;
}

.entries-list {
  max-height: 280px;
  overflow-y: auto;
  background: rgba(0,0,0,0.03);
  border-radius: var(--radius-md);
  padding: 12px;
  border: 1px solid rgba(0,0,0,0.05);
}

.entry-item {
  background: white;
  padding: 16px;
  border-radius: 14px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
  border-left: 5px solid var(--primary);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.entry-item:hover {
  transform: translateX(4px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  color: white;
  box-shadow: 0 8px 16px rgba(245, 158, 11, 0.2);
}

.btn-secondary {
  background: rgba(0,0,0,0.05);
  color: #4b5563;
  border: 1px solid rgba(0,0,0,0.1);
}

.btn-secondary:hover {
  background: rgba(0,0,0,0.1);
}

.btn:disabled {
  opacity: 0.5;
  filter: grayscale(0.5);
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.entry-item.exit {
  border-left-color: var(--danger);
}

.entry-type {
  font-weight: 700;
  color: #111827;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.entry-time {
  color: #6b7280;
  font-size: 13px;
  font-weight: 500;
  margin-top: 2px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 30px 20px;
  color: #999;
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 10px;
  opacity: 0.5;
}

/* Alerts */
.alert {
  padding: 14px;
  border-radius: 10px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  line-height: 1.4;
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert-error {
  background: #ffebee;
  color: #c62828;
  border-left: 4px solid #f44336;
}

.alert-success {
  background: #e8f5e9;
  color: #2e7d32;
  border-left: 4px solid #4caf50;
}

.alert-warning {
  background: #fff3e0;
  color: #e65100;
  border-left: 4px solid #ff9800;
}

/* Modals */
.password-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.password-modal:not(.hidden) {
  opacity: 1;
  visibility: visible;
}

.password-box {
  background: white;
  padding: 35px 30px;
  border-radius: 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.25);
  transform: translateY(20px);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.password-modal:not(.hidden) .password-box {
  transform: translateY(0);
}

.password-box h3 {
  margin-bottom: 8px;
  color: var(--primary-dark);
  font-size: 20px;
  text-align: center;
}

.error-text {
  color: #c62828;
  text-align: center;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  min-height: 20px;
}

.history-box {
  max-width: 500px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.history-content {
  overflow-y: auto;
  max-height: 60vh;
  padding-right: 10px;
}

/* Export Preview */
.export-preview {
  background: #f5f5f5;
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.6;
  border-left: 4px solid var(--primary);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 90%;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  background: #333;
  color: white;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: all;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

.toast.warning {
  background: #ff9800;
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* Responsive */
@media (max-width: 380px) {
  .container {
    padding: 20px;
  }
  
  h1 {
    font-size: 22px;
  }
  
  .btn {
    padding: 14px;
    font-size: 14px;
  }
  
  .status-time {
    font-size: 32px;
  }
}

/* iOS Safe Areas */
@supports (padding-top: env(safe-area-inset-top)) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}