/* ═══════════════════════════════════════════════════════
   MAGIC MAID CLEANING — Global Design System
   ═══════════════════════════════════════════════════════ */

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

/* ─── CSS Variables ─── */
:root {
  /* Brand Colors */
  --brand-navy:      #042d62;
  --brand-gold:      #deb423;
  --brand-white:     #ffffff;
  --brand-light:     #f4f6fb;
  --brand-dark:      #0a1628;

  --primary-rgb:     4, 45, 98;
  --secondary-rgb:   222, 180, 35;

  /* Navy Scale */
  --navy-400: #1a4a8a;
  --navy-500: #042d62;
  --navy-600: #032251;
  --navy-700: #021a3d;
  --navy-800: #010f24;

  /* Gold Scale */
  --gold-300: #f0cf5a;
  --gold-400: #e8c22e;
  --gold-500: #deb423;
  --gold-600: #c4a01f;
  --gold-700: #a8891a;

  /* Gray Scale */
  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-600: #4b5563;
  --gray-800: #1f2937;

  /* Status Colors */
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --error:   #dc2626;
  --error-bg: #fef2f2;
  --info:    #2563eb;
  --info-bg: #eff6ff;

  /* Shadows */
  --shadow-sm:  0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-xl:  0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Sidebar */
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --topbar-height: 64px;
}

/* ─── Reset & Base ─── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.6;
  color: var(--gray-800);
  background: var(--brand-light);
  min-height: 100vh;
}

a {
  color: var(--brand-navy);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--navy-400);
}

img, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
}

/* ─── Typography ─── */
h1 {
  font-size: 48px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--brand-navy);
}

h2 {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--brand-navy);
}

h3 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--brand-navy);
}

.body-large {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.7;
}

.label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-600);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.15);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:hover::after {
  opacity: 1;
}

.btn:active {
  transform: scale(0.97);
}

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

.btn-primary:hover {
  background: var(--navy-400);
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

.btn-secondary {
  background: var(--brand-gold);
  color: var(--brand-navy);
}

.btn-secondary:hover {
  background: var(--gold-400);
  box-shadow: 0 4px 12px rgba(var(--secondary-rgb), 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--brand-navy);
  border: 2px solid var(--gray-200);
}

.btn-outline:hover {
  border-color: var(--brand-navy);
  background: rgba(var(--primary-rgb), 0.04);
}

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

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

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
  border-radius: var(--radius-lg);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-icon.btn-sm {
  width: 32px;
  height: 32px;
}

/* ─── Form Controls ─── */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--brand-white);
  color: var(--gray-800);
  transition: all var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--brand-navy);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.form-control::placeholder {
  color: var(--gray-400);
}

.form-control.error {
  border-color: var(--error);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234b5563' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

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

/* ─── Cards ─── */
.card {
  background: var(--brand-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

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

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body {
  padding: 24px;
}

.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
}

/* ─── Stat Cards ─── */
.stat-card {
  background: var(--brand-white);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--brand-gold);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

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

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
}

.stat-card .stat-icon.navy {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--brand-navy);
}

.stat-card .stat-icon.gold {
  background: rgba(var(--secondary-rgb), 0.15);
  color: var(--gold-600);
}

.stat-card .stat-icon.green {
  background: var(--success-bg);
  color: var(--success);
}

.stat-card .stat-icon.orange {
  background: var(--warning-bg);
  color: var(--warning);
}

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--brand-navy);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
}

/* ─── Tables ─── */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-100);
}

table {
  width: 100%;
  border-collapse: collapse;
}

table thead {
  background: var(--gray-50);
  position: sticky;
  top: 0;
}

table th {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-600);
  text-align: left;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}

table td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--gray-800);
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

table tbody tr {
  transition: background var(--transition-fast);
}

table tbody tr:hover {
  background: var(--gray-50);
}

table tbody tr:last-child td {
  border-bottom: none;
}

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

.badge-navy {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--brand-navy);
}

.badge-gold {
  background: rgba(var(--secondary-rgb), 0.15);
  color: var(--gold-700);
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-error {
  background: var(--error-bg);
  color: var(--error);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info);
}

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

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

.modal {
  background: var(--brand-white);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px) scale(0.95);
  transition: transform var(--transition-base);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  border-bottom: 1px solid var(--gray-100);
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 18px;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--gray-200);
  color: var(--gray-800);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ─── Toast Notifications ─── */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  min-width: 320px;
  max-width: 460px;
  border-radius: var(--radius-md);
  background: var(--brand-white);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--gray-400);
  animation: toastIn 0.3s ease forwards;
}

.toast.success { border-left-color: var(--success); }
.toast.warning { border-left-color: var(--warning); }
.toast.error   { border-left-color: var(--error); }
.toast.info    { border-left-color: var(--info); }

.toast .toast-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.toast.success .toast-icon { color: var(--success); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.error   .toast-icon { color: var(--error); }
.toast.info    .toast-icon { color: var(--info); }

.toast .toast-message {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-800);
}

.toast .toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 18px;
  padding: 0;
  line-height: 1;
}

.toast .toast-close:hover {
  color: var(--gray-800);
}

.toast.removing {
  animation: toastOut 0.3s ease forwards;
}

/* ─── Search ─── */
.search-box {
  position: relative;
  max-width: 320px;
}

.search-box input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--brand-white);
  font-size: 14px;
  transition: all var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--brand-navy);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
  outline: none;
}

.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 16px;
  pointer-events: none;
}

/* ─── Empty State ─── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-state img,
.empty-state svg {
  width: 200px;
  margin-bottom: 24px;
  opacity: 0.8;
}

.empty-state h3 {
  color: var(--gray-600);
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--gray-400);
  margin-bottom: 20px;
}

/* ─── Loading Spinner ─── */
.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(var(--primary-rgb), 0.2);
  border-top-color: var(--brand-navy);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner.white {
  border-color: rgba(255,255,255,0.3);
  border-top-color: white;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  z-index: 10;
}

/* ─── Offline Banner ─── */
.offline-banner {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--warning);
  color: white;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3000;
}

body.offline .offline-banner {
  display: flex;
}

/* ─── Utility Classes ─── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--gray-400); }
.text-navy   { color: var(--brand-navy) !important; }
.text-gold   { color: var(--brand-gold) !important; }
.text-success { color: var(--success) !important; }
.text-error  { color: var(--error) !important; }
.text-small  { font-size: 12px; }

.d-flex     { display: flex; }
.d-grid     { display: grid; }
.d-none     { display: none; }
.d-block    { display: block; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.gap-8   { gap: 8px; }
.gap-12  { gap: 12px; }
.gap-16  { gap: 16px; }
.gap-20  { gap: 20px; }
.gap-24  { gap: 24px; }

.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.p-16  { padding: 16px; }
.p-24  { padding: 24px; }

.w-full { width: 100%; }
.relative { position: relative; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Animations ─── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

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

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(100%); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

@keyframes shimmer {
  0%   { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

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

.animate-fadeIn    { animation: fadeIn 0.4s ease forwards; }
.animate-fadeInUp  { animation: fadeInUp 0.5s ease forwards; }
.animate-scaleIn   { animation: scaleIn 0.3s ease forwards; }
.animate-shake     { animation: shake 0.4s ease; }
.animate-pulse     { animation: pulse 0.6s ease; }

/* Stagger animations */
.stagger > * {
  opacity: 0;
  animation: fadeInUp 0.4s ease forwards;
}

.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.3s; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 0%, var(--gray-50) 50%, var(--gray-100) 100%);
  background-size: 200px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--gray-200);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  h1 { font-size: 32px; }
  h2 { font-size: 24px; }
  h3 { font-size: 18px; }

  .stat-card .stat-value { font-size: 26px; }

  .toast {
    min-width: auto;
    max-width: calc(100vw - 48px);
  }

  .modal {
    max-width: 100%;
    border-radius: var(--radius-lg);
  }
}

@media (max-width: 480px) {
  h1 { font-size: 28px; }
  .stat-card { padding: 16px; }
}
