/* style.css - Premium Design System for CleanTime PWA */

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

:root {
  /* Color Palette */
  --bg-primary: #0a0c10;
  --bg-secondary: #11141a;
  --bg-tertiary: #171b24;
  --border-color: rgba(255, 255, 255, 0.06);
  --border-focus: rgba(16, 185, 129, 0.4);
  
  --accent-clean: #10b981; /* Mint / Emerald green */
  --accent-clean-rgb: 16, 185, 129;
  --accent-dark: #064e3b;
  --accent-cyan: #06b6d4;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  /* Fonts & Shadows */
  --font-main: 'Outfit', sans-serif;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-neon: 0 0 20px rgba(16, 185, 129, 0.25);
  
  /* Radii */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* App Skeleton Layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Site Header */
.site-header {
  background: rgba(17, 20, 26, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 0;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

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

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
  text-decoration: none;
  letter-spacing: -0.5px;
}

.brand-logo i {
  color: var(--accent-clean);
  filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.5));
}

.brand-logo .accent {
  color: var(--accent-clean);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 8px;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.nav-item a:hover {
  color: white;
  background: rgba(255, 255, 255, 0.03);
}

.nav-item.active a {
  color: var(--accent-clean);
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.15);
}

/* User switcher in header */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-premium {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  background: var(--accent-clean);
  color: #0b0d11;
  box-shadow: var(--shadow-neon);
}

.btn-primary:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.35);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
  border-color: var(--text-muted);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: var(--accent-red);
  color: white;
}

/* Role Switcher Widget */
.role-badge-floating {
  background: var(--bg-secondary);
  border: 1px solid var(--accent-clean);
  border-radius: 50px;
  padding: 4px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-clean);
  letter-spacing: 0.5px;
}

.role-badge-floating i {
  font-size: 0.7rem;
}

/* App Sections */
main {
  flex-grow: 1;
  padding: 30px 0;
}

.app-section {
  display: none;
}

.app-section.active {
  display: block;
}

/* --- MOBILE CHECK-IN VIEW --- */
.mobile-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 480px;
  margin: 0 auto;
}

.mobile-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  padding: 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.mobile-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-clean), var(--accent-cyan));
}

.cleaner-welcome {
  text-align: center;
  margin-bottom: 24px;
}

.cleaner-welcome h2 {
  font-size: 1.8rem;
  font-weight: 800;
}

.cleaner-welcome p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

.form-group {
  margin-bottom: 20px;
  width: 100%;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-select, .form-input, .form-textarea {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: white;
  padding: 12px 16px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  transition: all 0.2s ease;
  outline: none;
}

.form-select:focus, .form-input:focus, .form-textarea:focus {
  border-color: var(--accent-clean);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* Action Slider / Button */
.action-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 20px 0;
}

.clock-main-btn {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 4px solid var(--bg-tertiary);
  background: radial-gradient(circle, var(--accent-clean) 0%, #0c7a54 100%);
  color: #0b0d11;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  outline: none;
}

.clock-main-btn::after {
  content: '';
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 1px solid rgba(16, 185, 129, 0.2);
  animation: pulse-ring 2s infinite;
}

.clock-main-btn i {
  font-size: 2.2rem;
  margin-bottom: 6px;
}

.clock-main-btn span {
  font-weight: 800;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.clock-main-btn.active {
  background: radial-gradient(circle, var(--accent-red) 0%, #7f1d1d 100%);
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.3);
}

.clock-main-btn.active::after {
  border-color: rgba(239, 68, 68, 0.2);
}

.clock-main-btn:hover {
  transform: scale(1.03);
}

.clock-timer-display {
  font-size: 2rem;
  font-family: monospace;
  font-weight: 700;
  color: white;
  margin-top: 15px;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

/* GPS Status Widget */
.gps-status {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 10px;
}

.gps-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
}

.gps-indicator.active {
  background: var(--accent-clean);
  box-shadow: 0 0 8px var(--accent-clean);
  animation: blink 1.5s infinite;
}

.gps-indicator.error {
  background: var(--accent-red);
  box-shadow: 0 0 8px var(--accent-red);
}

.gps-info {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* History Logs widget in Mobile Card */
.mobile-history-title {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.history-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-details {
  display: flex;
  flex-direction: column;
}

.history-location {
  font-weight: 600;
  font-size: 0.9rem;
}

.history-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.history-duration {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-clean);
  background: rgba(16, 185, 129, 0.08);
  padding: 2px 8px;
  border-radius: 50px;
  border: 1px solid rgba(16, 185, 129, 0.15);
}

/* --- DESKTOP ADMIN PANEL VIEW --- */
.admin-tabs-section {
  margin-bottom: 24px;
}

.dashboard-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.summary-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.summary-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.08);
  color: var(--accent-clean);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.summary-icon.orange {
  background: rgba(245, 158, 11, 0.08);
  color: var(--accent-orange);
  border-color: rgba(245, 158, 11, 0.15);
}

.summary-icon.cyan {
  background: rgba(6, 182, 212, 0.08);
  color: var(--accent-cyan);
  border-color: rgba(6, 182, 212, 0.15);
}

.summary-info {
  display: flex;
  flex-direction: column;
}

.summary-val {
  font-size: 1.8rem;
  font-weight: 800;
}

.summary-lbl {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Tab contents */
.tab-content-panel {
  display: none;
}

.tab-content-panel.active {
  display: block;
}

/* Grid of Locations overview */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.location-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.location-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.12);
  box-shadow: var(--shadow-sm);
}

.location-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.location-type-badge {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.location-type-badge.casa {
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.location-type-badge.empresa {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-clean);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.location-type-badge.comercio {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-orange);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.location-status-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.location-status-badge.active {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.2);
  color: var(--accent-clean);
  animation: pulse-border 2s infinite;
}

.location-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.location-card-client {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.location-card-address {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
}

.location-active-staff {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: auto;
}

.location-active-staff-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.location-active-staff-member {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
}

.location-active-staff-member i {
  color: var(--accent-clean);
  animation: blink 1.5s infinite;
}

/* CRUD Table and Layout Panels */
.grid-panel-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
}

@media (min-width: 1024px) {
  .grid-panel-container {
    grid-template-columns: 1fr 340px;
  }
}

.crud-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.crud-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}

.crud-panel-title {
  font-size: 1.3rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.crud-search-row {
  display: flex;
  gap: 10px;
}

.crud-table-wrap {
  overflow-x: auto;
  width: 100%;
}

.crud-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.crud-table th, .crud-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.crud-table th {
  background: rgba(255, 255, 255, 0.01);
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

.crud-table tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

.badge {
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge.active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-clean);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge.inactive {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.action-buttons {
  display: flex;
  gap: 6px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  color: white;
  border-color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
}

.btn-icon.edit:hover {
  border-color: var(--accent-clean);
  color: var(--accent-clean);
  background: rgba(16, 185, 129, 0.05);
}

.btn-icon.delete:hover {
  border-color: var(--accent-red);
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.05);
}

/* Modals Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.3s ease;
  position: relative;
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-close:hover {
  color: white;
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 20px;
}

/* Utility Animations */
@keyframes pulse-ring {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.4;
  }
  100% {
    transform: scale(1.15);
    opacity: 0;
  }
}

@keyframes pulse-border {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fade-in 0.4s ease forwards;
}
