/* ==========================================================================
   KHELWADE HOSPITAL ATTENDANCE SYSTEM - DESIGN SYSTEM & STYLES
   ========================================================================== */

:root {
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --primary-light: #e0f2fe;
  --secondary: #0d9488;
  --bg-gradient: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #f8fafc 100%);
  --surface: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  
  --success: #10b981;
  --success-dark: #059669;
  --danger: #ef4444;
  --danger-dark: #dc2626;
  --warning: #f59e0b;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-glow-green: 0 0 25px rgba(16, 185, 129, 0.4);
  --shadow-glow-red: 0 0 25px rgba(239, 68, 68, 0.4);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Global */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  overflow-x: hidden;
}

/* Container */
.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.08);
}

@media (min-width: 640px) {
  body {
    padding: 24px 0;
  }
  .app-container {
    min-height: calc(100vh - 48px);
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, 0.8);
  }
}

/* Header */
.app-header {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  padding: 20px 20px 28px 20px;
  border-bottom-left-radius: 24px;
  border-bottom-right-radius: 24px;
  position: relative;
  box-shadow: var(--shadow-md);
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.brand-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.brand-title h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-title p {
  font-size: 0.75rem;
  opacity: 0.85;
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: justify;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.icon-btn:hover, .icon-btn:active {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

/* User Greeting Banner */
.user-greeting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-profile h2 {
  font-size: 0.95rem;
  font-weight: 600;
}

.user-profile span {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.25);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  display: inline-block;
  margin-top: 2px;
}

.live-clock {
  text-align: right;
}

.live-time {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: monospace;
  letter-spacing: 0.5px;
}

.live-date {
  font-size: 0.7rem;
  opacity: 0.85;
}

/* Main Content Area */
.app-content {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 20px;
}

/* Views */
.view-section {
  display: none;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.3s ease-in-out;
}

.view-section.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Login Screen */
.login-card {
  background: #ffffff;
  padding: 28px 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-header {
  text-align: center;
}

.login-header h2 {
  font-size: 1.35rem;
  color: var(--text-main);
  font-weight: 700;
}

.login-header p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-field {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
  background: #f8fafc;
}

.input-field:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #ffffff;
  border: none;
  padding: 14px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Dashboard Status Card */
.status-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.status-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--border);
  transition: var(--transition);
}

.status-card.punched-in::before {
  background: var(--success);
}

.status-card.punched-out::before {
  background: var(--danger);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.status-badge.in {
  background: #dcfce7;
  color: #15803d;
}

.status-badge.out {
  background: #fee2e2;
  color: #b91c1c;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-badge.in .status-dot {
  background: #16a34a;
  animation: pulse-green 1.8s infinite;
}

.status-badge.out .status-dot {
  background: #dc2626;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

/* Punch Action Button */
.punch-btn-container {
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 10px 0;
}

.punch-btn {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  border: none;
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 1px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
  position: relative;
}

.punch-btn.punch-in-btn {
  background: linear-gradient(145deg, #10b981 0%, #059669 100%);
  box-shadow: var(--shadow-glow-green), 0 10px 20px rgba(5, 150, 105, 0.3);
}

.punch-btn.punch-out-btn {
  background: linear-gradient(145deg, #ef4444 0%, #dc2626 100%);
  box-shadow: var(--shadow-glow-red), 0 10px 20px rgba(220, 38, 38, 0.3);
}

.punch-btn:hover {
  transform: scale(1.04);
}

.punch-btn:active {
  transform: scale(0.96);
}

/* GPS Geofence Card */
.gps-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gps-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gps-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gps-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.gps-badge.inside {
  background: #dcfce7;
  color: #15803d;
}

.gps-badge.outside {
  background: #fee2e2;
  color: #b91c1c;
}

.gps-badge.acquiring {
  background: #fef3c7;
  color: #b45309;
}

.punch-btn svg {
  width: 38px;
  height: 38px;
}

/* Session Timer Display */
.session-timer {
  background: #f8fafc;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.session-timer strong {
  font-family: monospace;
  font-size: 1.1rem;
  color: var(--primary-dark);
}

/* Shift Info Card */
.shift-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.info-tile {
  background: #f8fafc;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-tile span {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.info-tile p {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Attendance History View */
.history-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.select-field {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  background: #ffffff;
  color: var(--text-main);
  cursor: pointer;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-card {
  background: #ffffff;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-card span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-card h3 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-card {
  background: #ffffff;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.history-card:hover {
  border-color: var(--primary);
}

.history-date {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-date h4 {
  font-size: 0.9rem;
  font-weight: 700;
}

.history-date span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.history-times {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-times p {
  font-size: 0.82rem;
  font-weight: 600;
}

.history-times .hrs-pill {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  opacity: 0.4;
}

/* Bottom Navigation Bar */
.app-nav {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 64px;
  background: #ffffff;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  background: none;
  border: none;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.nav-item svg {
  width: 22px;
  height: 22px;
}

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

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 90%;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--text-main);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  animation: slideDown 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: auto;
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid var(--danger);
}

.toast.info {
  border-left: 4px solid var(--primary);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: #ffffff;
  width: 100%;
  max-width: 420px;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

/* Loading Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.8s linear infinite;
}

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

/* App Footer - VRTech Branding */
.app-footer {
  text-align: center;
  padding: 12px 16px;
  background: #f8fafc;
  border-top: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: auto;
}

.app-footer strong {
  color: var(--primary-dark);
  font-weight: 700;
}

/* Manager Portal Cards & Tables */
.card-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 480px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .btn-primary {
    grid-column: span 1 !important;
  }
}

.btn-secondary-sm {
  background: #f1f5f9;
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary-sm:hover {
  background: #e2e8f0;
}

/* Data Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}

.data-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.7rem;
  padding: 10px 8px;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  white-space: nowrap;
}

.badge-active {
  background: #dcfce7;
  color: #15803d;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
}

.badge-blocked {
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
}

.btn-toggle-status {
  border: none;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-toggle-status.block-btn {
  background: #fee2e2;
  color: #dc2626;
}

.btn-toggle-status.activate-btn {
  background: #dcfce7;
  color: #16a34a;
}
