/*
  Mini Ping - Modern App Styles
  A sophisticated, visually engaging design system for the application
  Based on the landing page design with app-specific components
*/

/* ========================================
   CSS VARIABLES (Imported from Landing)
   ======================================== */

:root {
  /* Brand Colors */
  --primary-50: #f5f3ff;
  --primary-100: #ede9fe;
  --primary-200: #ddd6fe;
  --primary-300: #c4b5fd;
  --primary-400: #a78bfa;
  --primary-500: #8b5cf6;
  --primary-600: #7c3aed;
  --primary-700: #6d28d9;
  --primary-800: #5b21b6;
  --primary-900: #4c1d95;

  --indigo-500: #6366f1;
  --indigo-600: #4f46e5;
  --indigo-700: #4338ca;
  --indigo-200: #c7d2fe;

  --emerald-50: #ecfdf5;
  --emerald-200: #a7f3d0;
  --emerald-400: #34d399;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;

  --rose-400: #fb7185;
  --rose-500: #f43f5e;
  --rose-600: #e11d48;

  --amber-400: #fbbf24;
  --amber-500: #f59e0b;

  /* Neutral Colors */
  --neutral-50: #fafafa;
  --neutral-100: #f5f5f5;
  --neutral-200: #e5e5e5;
  --neutral-300: #d4d4d4;
  --neutral-400: #a3a3a3;
  --neutral-500: #737373;
  --neutral-600: #525252;
  --neutral-700: #404040;
  --neutral-800: #262626;
  --neutral-900: #171717;

  /* Semantic Colors */
  --background: #fafafa;
  --surface: #ffffff;
  --text-primary: #0a0a0a;
  --text-secondary: #525252;
  --text-tertiary: #737373;
  --border: #e5e5e5;
  --border-light: #f5f5f5;

  /* Status Colors */
  --status-pending: #fef3c7;
  --status-pending-text: #92400e;
  --status-pending-border: #fde68a;

  --status-acknowledged: #dbeafe;
  --status-acknowledged-text: #1e3a8a;
  --status-acknowledged-border: #bfdbfe;

  --status-inactive: #f3f4f6;
  --status-inactive-text: #374151;
  --status-inactive-border: #e5e7eb;

  --status-opened: #d1fae5;
  --status-opened-text: #065f46;
  --status-opened-border: #a7f3d0;

  --status-ongoing: #dbeafe;
  --status-ongoing-text: #1e40af;
  --status-ongoing-border: #bfdbfe;

  --status-ended: #fee2e2;
  --status-ended-text: #991b1b;
  --status-ended-border: #fecaca;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --gradient-secondary: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  --gradient-danger: linear-gradient(135deg, #f43f5e 0%, #fb7185 100%);
  --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  --shadow-primary: 0 10px 30px -5px rgba(99, 102, 241, 0.3);
  --shadow-emerald: 0 10px 30px -5px rgba(16, 185, 129, 0.3);

  /* Border Radius */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  --radius-2xl: 1.5rem;
  --radius-3xl: 2rem;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;

  /* Animation */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   RESET & BASE
   ======================================== */

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

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

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--background);
  overflow-x: hidden;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.125rem; }

strong {
  font-weight: 600;
  color: var(--text-primary);
}

a {
  color: var(--indigo-600);
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--indigo-700);
  text-decoration: underline;
}

/* ========================================
   LAYOUT
   ======================================== */

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.container-small {
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

@media (min-width: 768px) {
  .container,
  .container-small {
    padding: 2.5rem 2rem;
  }
}

/* App Shell */
.app-shell-bg {
  position: relative;
  min-height: 100vh;
}

.app-shell-bg::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 10%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.10) 0%, transparent 45%),
    radial-gradient(circle at 40% 90%, rgba(16, 185, 129, 0.08) 0%, transparent 40%);
  animation: bgPulse 20s ease-in-out infinite alternate;
}

@keyframes bgPulse {
  0% {
    opacity: 0.8;
    transform: scale(1);
  }
  100% {
    opacity: 1;
    transform: scale(1.05);
  }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid rgba(99, 102, 241, 0.08);
}

.page-title {
  font-size: 2.25rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--indigo-700) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-subtitle {
  margin-top: 0.5rem;
  color: var(--text-secondary);
  font-size: 1.0625rem;
  font-weight: 400;
}

/* ========================================
   HEADER
   ======================================== */

header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.80);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid rgba(99, 102, 241, 0.1);
  box-shadow: 0 4px 24px -8px rgba(99, 102, 241, 0.12);
  margin-bottom: 2rem;
  transition: all var(--transition-base);
}

header:hover {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 32px -8px rgba(99, 102, 241, 0.18);
}

.header-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--indigo-600);
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: transform var(--transition-base);
}

.logo:hover {
  transform: translateY(-2px);
  text-decoration: none;
}

.logo::before {
  content: '📱';
  font-size: 1.75rem;
}

.user-info,
nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-name {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  background: var(--neutral-50);
  border-radius: var(--radius-full);
}

nav a {
  padding: 0.5rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  position: relative;
}

nav a::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: 2px;
  transition: width var(--transition-base);
}

nav a:hover {
  color: var(--indigo-600);
  background: var(--primary-50);
  text-decoration: none;
}

nav a:hover::before {
  width: 80%;
}

nav a.active {
  color: var(--indigo-700);
  background: var(--primary-100);
  box-shadow: inset 0 0 0 1.5px var(--indigo-200);
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font-sans);
  text-decoration: none;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 40px -10px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-success {
  background: var(--gradient-secondary);
  color: white;
  box-shadow: var(--shadow-emerald);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 40px -10px rgba(16, 185, 129, 0.4);
}

.btn-danger {
  background: var(--gradient-danger);
  color: white;
  box-shadow: 0 10px 30px -5px rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 40px -10px rgba(244, 63, 94, 0.4);
}

.btn-secondary {
  background: var(--neutral-100);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover {
  background: var(--neutral-200);
  border-color: var(--neutral-300);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1.5px solid var(--border);
}

.btn-outline:hover {
  background: var(--primary-50);
  border-color: var(--indigo-500);
  color: var(--indigo-600);
}

.btn-small {
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
}

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

/* Loading State */
.btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ========================================
   CARDS
   ======================================== */

.card {
  background: rgba(255, 255, 255, 0.90);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: var(--radius-2xl);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 32px -8px rgba(99, 102, 241, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
  transition: all var(--transition-slow);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.card:hover {
  box-shadow: 0 12px 48px -12px rgba(99, 102, 241, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.2);
}

.card:hover::before {
  opacity: 1;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-light);
}

.card-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 1.75rem;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
}

.card-body {
  padding: 0.5rem 0;
}

/* ========================================
   FORMS
   ======================================== */

.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--surface);
  transition: all var(--transition-base);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--indigo-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-tertiary);
}

.form-hint {
  display: block;
  margin-top: 0.375rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.field-error {
  display: block;
  margin-top: 0.375rem;
  font-size: 0.875rem;
  color: var(--rose-600);
  font-weight: 500;
}

input.error,
select.error,
textarea.error {
  border-color: var(--rose-500);
  background-color: rgba(244, 63, 94, 0.05);
}

input.error:focus,
select.error:focus,
textarea.error:focus {
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.1);
}

/* ========================================
   LISTS
   ======================================== */

.list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(99, 102, 241, 0.08);
  border-radius: var(--radius-xl);
  transition: all var(--transition-base);
  gap: 1rem;
  position: relative;
  overflow: hidden;
}

.list-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--gradient-primary);
  transform: scaleY(0);
  transition: transform var(--transition-base);
}

.list-item:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(99, 102, 241, 0.2);
  transform: translateX(6px);
  box-shadow: 0 8px 24px -8px rgba(99, 102, 241, 0.15);
}

.list-item:hover::before {
  transform: scaleY(1);
}

.list-item-title {
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.list-item-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.list-item-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ========================================
   BADGES
   ======================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1.5px solid;
  white-space: nowrap;
}

.badge-pending {
  background-color: var(--status-pending);
  color: var(--status-pending-text);
  border-color: var(--status-pending-border);
}

.badge-acknowledged {
  background-color: var(--status-acknowledged);
  color: var(--status-acknowledged-text);
  border-color: var(--status-acknowledged-border);
}

.badge-inactive {
  background-color: var(--status-inactive);
  color: var(--status-inactive-text);
  border-color: var(--status-inactive-border);
}

.badge-opened {
  background-color: var(--status-opened);
  color: var(--status-opened-text);
  border-color: var(--status-opened-border);
}

.badge-ongoing {
  background-color: var(--status-ongoing);
  color: var(--status-ongoing-text);
  border-color: var(--status-ongoing-border);
}

.badge-ended {
  background-color: var(--status-ended);
  color: var(--status-ended-text);
  border-color: var(--status-ended-border);
}

/* ========================================
   MODAL
   ======================================== */

.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease-out;
}

.modal.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: var(--surface);
  padding: 2rem;
  border-radius: var(--radius-2xl);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-2xl);
  animation: slideUp 0.3s ease-out;
  border: 1px solid var(--border);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-light);
}

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

.modal-close {
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-tertiary);
  transition: all var(--transition-base);
  background: var(--neutral-100);
  border: none;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--neutral-200);
  transform: rotate(90deg);
}

/* ========================================
   ALERTS
   ======================================== */

.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  border: 1.5px solid;
  font-size: 0.9375rem;
  line-height: 1.6;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transform: translateZ(0);
}

.alert-success {
  background-color: var(--emerald-50);
  color: var(--emerald-700);
  border-color: var(--emerald-200);
}

.alert-error {
  background-color: rgba(244, 63, 94, 0.05);
  color: var(--rose-600);
  border-color: var(--rose-400);
}

.alert-info {
  background-color: var(--status-acknowledged);
  color: var(--status-acknowledged-text);
  border-color: var(--status-acknowledged-border);
}

/* Toast-like slide animations */
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

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

/* ========================================
   LOADING & EMPTY STATES
   ======================================== */

.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}

.spinner {
  border: 4px solid var(--border);
  border-top: 4px solid var(--indigo-600);
  border-radius: 50%;
  width: 3rem;
  height: 3rem;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: linear-gradient(135deg, rgba(248, 250, 255, 0.8) 0%, rgba(255, 255, 255, 0.6) 100%);
  border-radius: var(--radius-xl);
  border: 2px dashed rgba(99, 102, 241, 0.2);
  position: relative;
  overflow: hidden;
}

.empty-state::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.05) 0%, transparent 70%);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.4;
  position: relative;
  z-index: 1;
}

.empty-state-text {
  font-size: 1.25rem;
  color: var(--text-secondary);
  font-weight: 600;
  position: relative;
  z-index: 1;
  margin-bottom: 0.5rem;
}

.empty-state img {
  max-width: 320px;
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 1.5rem;
  opacity: 0.85;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.1));
}

.empty-state p {
  position: relative;
  z-index: 1;
}

/* ========================================
   AUTH PAGE SPECIFIC
   ======================================== */

.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
  position: relative;
  overflow: hidden;
}

.auth-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(at 40% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(at 80% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
  z-index: 0;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 960px;
  margin: 2rem;
}

.auth-card .card {
  box-shadow: var(--shadow-xl);
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo .logo {
  display: inline-flex;
  font-size: 2rem;
}

/* Split card layout for auth */
.auth-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  overflow: hidden;
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border);
}

@media (min-width: 900px) {
  .auth-split {
    grid-template-columns: 1fr 1fr;
  }
}

.auth-illustration {
  background:
    radial-gradient(circle at 30% 30%, rgba(99,102,241,0.15) 0%, transparent 50%),
    radial-gradient(circle at 70% 70%, rgba(139,92,246,0.12) 0%, transparent 50%),
    linear-gradient(180deg, #ffffff 0%, #f8f9ff 100%);
  padding: 3rem 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.auth-illustration::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.06) 0%, transparent 70%);
  animation: float 15s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(30px, -30px) rotate(5deg); }
  66% { transform: translate(-20px, 20px) rotate(-5deg); }
}

.auth-illustration-inner {
  text-align: center;
  position: relative;
  z-index: 1;
}

.auth-illustration-icon {
  margin-bottom: 1.5rem;
  display: inline-block;
  animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

.auth-illustration h3 {
  font-size: 1.75rem;
  margin-top: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-illustration p {
  color: var(--text-secondary);
  margin-top: 0.75rem;
  font-size: 1.0625rem;
  line-height: 1.6;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.auth-form-panel {
  background: var(--surface);
  padding: 3rem 2.5rem;
}

@media (max-width: 899px) {
  .auth-form-panel {
    padding: 2rem 1.5rem;
  }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.hidden {
  display: none !important;
}

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

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

.mt-20 {
  margin-top: 1.25rem;
}

.mb-20 {
  margin-bottom: 1.25rem;
}

.flex {
  display: flex;
}

.gap-10 {
  gap: 0.625rem;
}

.justify-between {
  justify-content: space-between;
}

.align-center {
  align-items: center;
}

.grid {
  display: grid;
  gap: 1.25rem;
}

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.muted { color: var(--text-secondary); }
.pill { padding: 0.25rem 0.625rem; border-radius: var(--radius-full); background: var(--neutral-100); font-weight: 600; font-size: 0.8rem; }
.divider { height: 1px; background: var(--border); margin: 1rem 0; }

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
  .header-content {
    flex-wrap: wrap;
  }

  nav {
    flex-wrap: wrap;
  }

  .list-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .list-item-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .card {
    padding: 1.5rem;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}

/* ========================================
   ANIMATIONS
   ======================================== */

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

.animate-in {
  animation: fadeInUp 0.5s ease-out;
}

.hover-raise {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.hover-raise:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

:focus-visible {
  outline: 2px solid var(--indigo-600);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ========================================
   NEW COMPONENTS FOR APP SHELL REVAMP
   ======================================== */

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: var(--radius-xl);
  box-shadow: 0 4px 20px -6px rgba(99, 102, 241, 0.12);
  transition: all var(--transition-base);
}

.toolbar:hover {
  box-shadow: 0 6px 28px -6px rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.18);
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr; }
}

.stat-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 255, 0.90) 100%);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: 0 8px 24px -8px rgba(99, 102, 241, 0.12);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
  transition: transform var(--transition-slow);
}

.stat-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 32px -8px rgba(99, 102, 241, 0.20);
  border-color: rgba(99, 102, 241, 0.25);
}

.stat-card:hover::before {
  transform: scale(1.1);
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: relative;
  z-index: 1;
}

.stat-value {
  font-size: 2.25rem;
  font-weight: 800;
  margin-top: 0.5rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  z-index: 1;
}

.stat-trend {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-tertiary);
  position: relative;
  z-index: 1;
}

/* Cards grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
@media (max-width: 1024px) {
  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .cards-grid { grid-template-columns: 1fr; }
}

.app-card {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: var(--radius-2xl);
  padding: 1.5rem;
  box-shadow: 0 4px 24px -6px rgba(99, 102, 241, 0.12);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.app-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transition: transform var(--transition-base);
}

.app-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 12px 40px -10px rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.25);
}

.app-card:hover::after {
  transform: scaleX(1);
}

.app-card h4 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.app-card .meta {
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Avatar */
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.0625rem;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 16px -4px rgba(99, 102, 241, 0.4), 0 0 0 3px rgba(99, 102, 241, 0.08);
  transition: all var(--transition-base);
  position: relative;
}

.avatar:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 6px 24px -4px rgba(99, 102, 241, 0.5), 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 0.875rem;
  border-width: 2px;
}

.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 1.5rem;
  border-width: 3px;
}

.avatar-stack { display: inline-flex; }
.avatar-stack .avatar {
  margin-left: -12px;
  box-shadow: 0 4px 12px -4px rgba(99, 102, 241, 0.3);
  border: 3px solid white;
}
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack .avatar:hover {
  z-index: 10;
}

/* Stepper */
.stepper { display: flex; gap: 0.75rem; margin-bottom: 1rem; }
.step { display: flex; align-items: center; gap: 0.5rem; color: var(--text-secondary); font-weight: 600; }
.step .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--neutral-300); }
.step.active { color: var(--indigo-700); }
.step.active .dot { background: var(--indigo-600); box-shadow: 0 0 0 4px rgba(99,102,241,0.15); }

/* Hero */
.app-hero {
  padding: 2rem 2rem;
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: var(--radius-2xl);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 255, 0.90) 100%),
    radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 50%);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  box-shadow: 0 8px 32px -8px rgba(99, 102, 241, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
  position: relative;
  overflow: hidden;
}

.app-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
}

.app-hero h2 {
  font-size: 1.875rem;
  margin-bottom: 0.375rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-hero p {
  color: var(--text-secondary);
  font-size: 1.0625rem;
}

@media (max-width: 768px) {
  .app-hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem;
  }
}

/* Badges nuanced */
.badge + .badge { margin-left: 0.5rem; }

/* ========================================
   SIDEBAR NAVIGATION
   ======================================== */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 220px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(24px);
  border-right: 1px solid rgba(99, 102, 241, 0.12);
  box-shadow: 4px 0 24px -8px rgba(99, 102, 241, 0.12);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition-base);
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--indigo-600);
  text-decoration: none;
  transition: transform var(--transition-base);
}

.sidebar-logo:hover {
  transform: translateX(4px);
  text-decoration: none;
}

.sidebar-logo svg {
  color: var(--indigo-600);
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--neutral-100);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-base);
}

.sidebar-toggle:hover {
  background: var(--neutral-200);
  color: var(--text-primary);
}

.sidebar-nav {
  flex: 1;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
}

.sidebar-link svg {
  flex-shrink: 0;
}

.sidebar-link:hover {
  color: var(--indigo-600);
  background: var(--primary-50);
  text-decoration: none;
}

.sidebar-link.active {
  color: var(--indigo-700);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(139, 92, 246, 0.08) 100%);
  font-weight: 600;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-light);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 999;
  opacity: 0;
  transition: opacity var(--transition-base);
}

/* Layout with sidebar */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  margin-left: 220px;
  transition: margin-left var(--transition-base);
}

.app-main header {
  margin-left: 0;
}

/* Mobile responsive */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  .sidebar-toggle {
    display: flex;
  }

  .sidebar-overlay.active {
    display: block;
    opacity: 1;
  }

  .app-main {
    margin-left: 0;
  }

  body.sidebar-open {
    overflow: hidden;
  }
}

/* Mobile header when sidebar is used */
.mobile-header {
  display: none;
  position: sticky;
  top: 0;
  z-index: 900;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(99, 102, 241, 0.12);
  padding: 1rem 1.5rem;
  margin-bottom: 0;
}

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

.mobile-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: var(--neutral-100);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-base);
}

.mobile-menu-btn:hover {
  background: var(--neutral-200);
  color: var(--text-primary);
}

@media (max-width: 1024px) {
  .mobile-header {
    display: block;
  }

  header {
    display: none;
  }
}

/* ========================================
   PWA INSTALL BANNER
   ======================================== */

.pwa-install-banner {
  position: fixed;
  bottom: -100%;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(24px);
  border-top: 2px solid rgba(99, 102, 241, 0.15);
  box-shadow: 0 -4px 24px -4px rgba(99, 102, 241, 0.15),
              0 -2px 8px -2px rgba(99, 102, 241, 0.1),
              0 0 0 1px rgba(255, 255, 255, 0.8) inset;
  padding: 1rem 1.5rem;
  z-index: 9999;
  transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 100%;
}

.pwa-install-banner.pwa-banner-visible {
  bottom: 0;
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
}

.pwa-banner-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-primary);
  border-radius: 14px;
  color: white;
  box-shadow: 0 4px 16px -4px rgba(99, 102, 241, 0.5),
              0 2px 8px -2px rgba(99, 102, 241, 0.3);
}

.pwa-banner-text {
  flex: 1;
  min-width: 0;
}

.pwa-banner-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: #0a0a0a;
  margin-bottom: 0.375rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.pwa-banner-subtitle {
  font-size: 0.9375rem;
  color: #525252;
  line-height: 1.5;
  opacity: 0.9;
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-shrink: 0;
}

.pwa-banner-actions .btn {
  white-space: nowrap;
  font-weight: 600;
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
}

.pwa-banner-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: #f5f5f5;
  border-radius: 8px;
  cursor: pointer;
  color: #525252;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.pwa-banner-close:hover {
  background: #e5e5e5;
  color: #0a0a0a;
  transform: scale(1.05);
}

/* Urgent banner variant for parent views */
.pwa-install-banner.pwa-banner-urgent {
  background: linear-gradient(135deg,
    rgba(251, 113, 133, 0.06) 0%,
    rgba(251, 146, 60, 0.06) 100%),
    rgba(255, 255, 255, 0.98);
  border-top: 2px solid rgba(251, 113, 133, 0.25);
  box-shadow: 0 -4px 24px -4px rgba(251, 113, 133, 0.2),
              0 -2px 8px -2px rgba(251, 113, 133, 0.15),
              0 0 0 1px rgba(255, 255, 255, 0.8) inset;
}

.pwa-banner-urgent .pwa-banner-icon {
  background: linear-gradient(135deg, #f43f5e 0%, #fb923c 100%);
  animation: pulse-urgent 2s ease-in-out infinite;
}

@keyframes pulse-urgent {
  0%, 100% {
    box-shadow: 0 4px 16px -4px rgba(244, 63, 94, 0.4);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 4px 24px -4px rgba(244, 63, 94, 0.6);
    transform: scale(1.05);
  }
}

.pwa-banner-urgent .pwa-banner-title {
  color: #991b1b;
}

.pwa-banner-urgent .pwa-banner-subtitle {
  color: #dc2626;
}

/* Responsive */
@media (max-width: 768px) {
  .pwa-install-banner {
    padding: 1rem;
  }

  .pwa-banner-content {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .pwa-banner-icon {
    width: 40px;
    height: 40px;
  }

  .pwa-banner-text {
    flex: 1 1 100%;
    order: 2;
  }

  .pwa-banner-actions {
    flex: 1 1 auto;
    order: 3;
    width: 100%;
    justify-content: stretch;
  }

  .pwa-banner-actions button:not(.pwa-banner-close) {
    flex: 1;
  }

  .pwa-banner-close {
    order: 1;
    margin-left: auto;
  }

  .pwa-banner-title {
    font-size: 0.9375rem;
  }

  .pwa-banner-subtitle {
    font-size: 0.8125rem;
  }
}

@media (max-width: 480px) {
  .pwa-banner-icon {
    display: none;
  }
}
