/* ==========================================================================
   StoreOps & BeautyCare Manager - Modern Clean & Professional CSS
   Palette: Slate #1E293B | Accent Indigo #4F46E5 | Success Emerald #10B981 | Bg #F8FAFC
   ========================================================================== */

:root {
  --primary-slate: #1e293b;
  --primary-slate-dark: #0f172a;
  --primary-slate-light: #334155;
  --accent-indigo: #4f46e5;
  --accent-indigo-hover: #4338ca;
  --accent-indigo-light: #eef2ff;
  --accent-indigo-glow: rgba(79, 70, 229, 0.15);
  --status-emerald: #10b981;
  --status-emerald-light: #ecfdf5;
  --status-amber: #f59e0b;
  --status-amber-light: #fef3c7;
  --status-rose: #ef4444;
  --status-rose-light: #fee2e2;
  --status-sky: #0ea5e9;
  --status-sky-light: #e0f2fe;

  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --border-color: #e2e8f0;
  --border-focus: #cbd5e1;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-white: #ffffff;

  --sidebar-width: 260px;
  --header-height: 68px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 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.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* App Shell Layout */
#app-shell {
  display: flex;
  min-height: 100vh;
}

#app-shell.login-mode #sidebar,
#app-shell.login-mode #mobile-header,
#app-shell.login-mode #top-navbar {
  display: none !important;
}

#app-shell.login-mode #main-wrapper {
  margin-left: 0 !important;
  width: 100% !important;
  padding: 0 !important;
  background: radial-gradient(circle at top right, #e0e7ff 0%, #f8fafc 60%);
}

/* Sidebar */
#sidebar {
  width: var(--sidebar-width);
  background-color: var(--primary-slate);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  transition: transform var(--transition-normal);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-indigo), #6366f1);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-light);
  font-weight: 500;
}

.sidebar-menu {
  flex: 1;
  padding: 20px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  font-weight: 700;
  padding: 10px 12px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #94a3b8;
  text-decoration: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.92rem;
  transition: all var(--transition-fast);
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.nav-link.active {
  background-color: var(--accent-indigo);
  color: #ffffff;
  box-shadow: 0 4px 12px var(--accent-indigo-glow);
}

.nav-link i {
  font-size: 1.15rem;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.badge-coming-soon {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background-color: rgba(0, 0, 0, 0.15);
}

.user-profile-widget {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-role {
  font-size: 0.75rem;
  color: #94a3b8;
}

.btn-logout {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* Main Content Wrapper */
#main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* Top Navbar */
#top-navbar {
  height: var(--header-height);
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}

.page-header-info h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.page-header-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.top-navbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background-color: var(--accent-indigo-light);
  color: var(--accent-indigo);
  border: 1px solid rgba(79, 70, 229, 0.2);
}

.mode-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background-color: var(--accent-indigo);
  animation: pulse 2s infinite;
}

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

/* Mobile Header */
#mobile-header {
  display: none;
  height: 60px;
  background-color: var(--primary-slate);
  color: #fff;
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 35;
}

.hamburger-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

/* Dynamic App Container */
#app {
  flex: 1;
  padding: 28px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* Anti-flicker Page Fragment Transition */
.page-fragment {
  animation: fadeIn 0.25s ease-out forwards;
}

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

/* Bento Grid System */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
}

.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }

/* Cards */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  position: relative;
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Stat Cards */
.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
}

.stat-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-icon-indigo {
  background: var(--accent-indigo-light);
  color: var(--accent-indigo);
}

.stat-icon-emerald {
  background: var(--status-emerald-light);
  color: var(--status-emerald);
}

.stat-icon-amber {
  background: var(--status-amber-light);
  color: var(--status-amber);
}

.stat-icon-sky {
  background: var(--status-sky-light);
  color: var(--status-sky);
}

.stat-content {
  flex: 1;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  margin-top: 2px;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--accent-indigo);
  color: #fff;
  box-shadow: 0 2px 6px var(--accent-indigo-glow);
}

.btn-primary:hover {
  background-color: var(--accent-indigo-hover);
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
  background-color: #fff;
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: var(--bg-subtle);
  border-color: var(--border-focus);
}

.btn-success {
  background-color: var(--status-emerald);
  color: #fff;
}

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

.btn-danger {
  background-color: var(--status-rose);
  color: #fff;
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 12px 24px;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
}

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

/* Badges & Status Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-emerald {
  background-color: var(--status-emerald-light);
  color: #065f46;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-indigo {
  background-color: var(--accent-indigo-light);
  color: var(--accent-indigo);
  border: 1px solid rgba(79, 70, 229, 0.2);
}

.badge-amber {
  background-color: var(--status-amber-light);
  color: #92400e;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-rose {
  background-color: var(--status-rose-light);
  color: #991b1b;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-slate {
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

/* Form Elements */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: #fff;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-main);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

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

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

.input-icon-wrapper {
  position: relative;
}

.input-icon-wrapper i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.input-icon-wrapper .form-input {
  padding-left: 38px;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table-custom {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}

.table-custom th {
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.table-custom th:first-child {
  border-top-left-radius: var(--radius-md);
}
.table-custom th:last-child {
  border-top-right-radius: var(--radius-md);
}

.table-custom td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.88rem;
  vertical-align: middle;
}

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

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

.table-custom tbody tr:hover {
  background-color: rgba(241, 245, 249, 0.6);
}

/* Tabs */
.tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tab-btn:hover {
  background-color: var(--bg-subtle);
  color: var(--text-main);
}

.tab-btn.active {
  background-color: var(--accent-indigo);
  color: #fff;
}

/* Progress Bar */
.progress-bar-container {
  width: 100%;
  height: 8px;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--accent-indigo), var(--status-emerald));
  transition: width 0.4s ease;
}

/* Checklist Item Styles */
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: #fff;
  margin-bottom: 12px;
  transition: all var(--transition-fast);
}

.checklist-item.completed {
  background-color: var(--status-emerald-light);
  border-color: rgba(16, 185, 129, 0.3);
}

.checklist-checkbox {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--status-emerald);
  cursor: pointer;
  flex-shrink: 0;
}

.checklist-content {
  flex: 1;
}

.checklist-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-main);
}

.checklist-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.photo-proof-preview {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.photo-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 2px solid var(--border-color);
  cursor: pointer;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

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

.modal-card {
  background-color: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform var(--transition-normal);
}

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

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

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  border-bottom-left-radius: var(--radius-xl);
  border-bottom-right-radius: var(--radius-xl);
}

.btn-close-modal {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-close-modal:hover {
  color: var(--text-main);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 380px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background-color: #fff;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  font-weight: 500;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

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

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

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

/* Login Page Styles */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-2xl, 24px);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 440px;
  padding: 40px 36px;
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--accent-indigo), #6366f1);
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 28px;
  box-shadow: 0 8px 16px rgba(79, 70, 229, 0.3);
  margin-bottom: 12px;
}

.login-brand h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary-slate);
}

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

.preview-badge-card {
  background-color: var(--accent-indigo-light);
  border: 1px dashed rgba(79, 70, 229, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 20px;
  font-size: 0.8rem;
  color: var(--accent-indigo);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Roadmap Grid */
.roadmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.roadmap-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  position: relative;
  overflow: hidden;
  opacity: 0.9;
}

.roadmap-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: #f59e0b;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .col-8 { grid-column: span 12; }
  .col-4 { grid-column: span 12; }
  .col-6 { grid-column: span 12; }
  .col-3 { grid-column: span 6; }
}

@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 39;
  }

  #sidebar-backdrop.open {
    display: block;
  }

  #main-wrapper {
    margin-left: 0;
  }

  #mobile-header {
    display: flex;
  }

  #top-navbar {
    display: none;
  }

  #app {
    padding: 16px;
  }

  .col-3 { grid-column: span 12; }
  
  .card {
    padding: 18px;
  }
}
