/* ========================================
   LIQUID GLASS DESIGN SYSTEM
   iOS-style glassmorphism theme
   ======================================== */

/* Reset and base styles */
html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  overflow-x: hidden;
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  min-height: 100vh;
  position: relative;
}

* {
  box-sizing: border-box;
}

/* ========================================
   COLOR SYSTEM & VARIABLES
   ======================================== */
:root {
  /* Liquid Glass Colors */
  --glass-primary: rgba(147, 51, 234, 0.15);
  --glass-secondary: rgba(59, 130, 246, 0.15);
  --glass-tertiary: rgba(236, 72, 153, 0.15);
  --glass-success: rgba(34, 197, 94, 0.15);
  --glass-warning: rgba(251, 146, 60, 0.15);
  --glass-danger: rgba(239, 68, 68, 0.15);
  
  /* Base Colors */
  --bg-base: #0a0118;
  --bg-gradient-1: #1a0f2e;
  --bg-gradient-2: #2d1b4e;
  --bg-gradient-3: #0f172a;
  
  /* Glass Effects */
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-bg-hover: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-border-light: rgba(255, 255, 255, 0.2);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  --glass-shadow-hover: 0 12px 48px rgba(0, 0, 0, 0.3);
  --glass-blur: 20px;
  --glass-blur-heavy: 40px;
  
  /* Text Colors */
  --text-primary: rgba(255, 255, 255, 0.95);
  --text-secondary: rgba(255, 255, 255, 0.75);
  --text-muted: rgba(255, 255, 255, 0.5);
  --text-disabled: rgba(255, 255, 255, 0.3);
  
  /* Gradient Colors */
  --gradient-purple: linear-gradient(135deg, #9333ea 0%, #6366f1 100%);
  --gradient-pink: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
  --gradient-blue: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  --gradient-green: linear-gradient(135deg, #22c55e 0%, #10b981 100%);
  --gradient-orange: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
  --gradient-mesh: linear-gradient(115deg, 
    rgba(147, 51, 234, 0.3) 0%, 
    rgba(59, 130, 246, 0.2) 30%, 
    rgba(236, 72, 153, 0.3) 60%, 
    rgba(147, 51, 234, 0.2) 100%);
  
  /* Animations */
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --transition-elastic: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ========================================
   ANIMATED BACKGROUND
   ======================================== */
body {
  background: var(--bg-base);
  position: relative;
  color: var(--text-primary);
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 50%, var(--bg-gradient-1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, var(--bg-gradient-2) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, var(--bg-gradient-3) 0%, transparent 50%);
  z-index: -1;
}

/* Animated gradient orbs */
.liquid-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

.liquid-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.6;
  animation: float 20s infinite ease-in-out;
}

.liquid-orb:nth-child(1) {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(147, 51, 234, 0.8), transparent);
  top: -200px;
  left: -200px;
  animation-duration: 25s;
}

.liquid-orb:nth-child(2) {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.8), transparent);
  top: 50%;
  right: -100px;
  animation-duration: 30s;
  animation-delay: -5s;
}

.liquid-orb:nth-child(3) {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.8), transparent);
  bottom: -150px;
  left: 30%;
  animation-duration: 35s;
  animation-delay: -10s;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  25% {
    transform: translate(100px, -100px) rotate(90deg) scale(1.1);
  }
  50% {
    transform: translate(-50px, 100px) rotate(180deg) scale(0.9);
  }
  75% {
    transform: translate(-100px, -50px) rotate(270deg) scale(1.05);
  }
}

/* ========================================
   GLASS COMPONENTS
   ======================================== */

/* Glass panel base */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: var(--glass-shadow);
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.glass::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-mesh);
  opacity: 0.1;
  z-index: -1;
  transition: opacity 0.3s ease;
}

.glass:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-light);
  box-shadow: var(--glass-shadow-hover);
  transform: translateY(-2px);
}

.glass:hover::before {
  opacity: 0.15;
}

/* Header */
.app-header {
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(var(--glass-blur-heavy));
  -webkit-backdrop-filter: blur(var(--glass-blur-heavy));
  border-bottom: 1px solid var(--glass-border);
  padding: 20px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: var(--transition-smooth);
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-header .logo {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--gradient-purple);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 20px;
  color: white;
  box-shadow: 0 4px 16px rgba(147, 51, 234, 0.3);
  transition: var(--transition-bounce);
}

.app-header .logo:hover {
  transform: rotate(-10deg) scale(1.1);
  box-shadow: 0 6px 24px rgba(147, 51, 234, 0.5);
}

.app-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.app-header .subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Main content area */
.app-main {
  padding: 24px;
  min-height: calc(100vh - 80px);
  max-width: 1400px;
  margin: 0 auto;
}

/* Sections */
.section-auth,
.section-app {
  animation: fadeInUp 0.8s ease-out;
}

/* Cards */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 32px;
  box-shadow: var(--glass-shadow);
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.card::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  transform: rotate(45deg);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

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

/* Auth card special styling */
.auth-card {
  max-width: 480px;
  margin: 60px auto;
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
}

.auth-card h2 {
  margin: 0 0 16px 0;
  font-size: 28px;
  font-weight: 700;
  background: var(--gradient-purple);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
  appearance: none;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-primary);
  padding: 14px 24px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  letter-spacing: 0.2px;
}

.btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-light);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn:active::before {
  width: 300px;
  height: 300px;
}

/* Primary button */
.btn.primary {
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.9), rgba(99, 102, 241, 0.9));
  border: 1px solid rgba(147, 51, 234, 0.3);
  color: white;
  box-shadow: 0 4px 16px rgba(147, 51, 234, 0.3);
}

.btn.primary:hover {
  background: linear-gradient(135deg, rgba(147, 51, 234, 1), rgba(99, 102, 241, 1));
  box-shadow: 0 6px 24px rgba(147, 51, 234, 0.5);
  transform: translateY(-2px);
}

/* Secondary button */
.btn.secondary {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.9), rgba(244, 63, 94, 0.9));
  border: 1px solid rgba(236, 72, 153, 0.3);
  color: white;
  box-shadow: 0 4px 16px rgba(236, 72, 153, 0.3);
}

.btn.secondary:hover {
  background: linear-gradient(135deg, rgba(236, 72, 153, 1), rgba(244, 63, 94, 1));
  box-shadow: 0 6px 24px rgba(236, 72, 153, 0.5);
}

/* Success button */
.btn.success {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.9), rgba(16, 185, 129, 0.9));
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: white;
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
}

.btn.success:hover {
  background: linear-gradient(135deg, rgba(34, 197, 94, 1), rgba(16, 185, 129, 1));
  box-shadow: 0 6px 24px rgba(34, 197, 94, 0.5);
}

/* ========================================
   FORM ELEMENTS
   ======================================== */
.input,
.select {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 14px 18px;
  border-radius: 12px;
  width: 100%;
  font-size: 15px;
  transition: var(--transition-smooth);
  outline: none;
}

.input::placeholder {
  color: var(--text-muted);
}

.input:focus,
.select:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--glass-border-light);
  box-shadow: 0 0 0 4px rgba(147, 51, 234, 0.1);
}

/* Search input with icon */
.search-input {
  padding-left: 48px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba(255,255,255,0.5)'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 16px center;
  background-size: 20px;
}

/* ========================================
   TOOLBAR
   ======================================== */
.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  padding: 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  flex-wrap: wrap;
}

.searchbar {
  margin-bottom: 20px;
}

/* ========================================
   LAYOUT
   ======================================== */
.layout {
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 968px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.panel {
  min-height: 400px;
}

/* ========================================
   TREE CONTAINER
   ======================================== */
.tree-container {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  min-height: 400px;
  padding: 24px;
  box-shadow: var(--glass-shadow);
}

/* Cards grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

/* ========================================
   PERSON CARDS
   ======================================== */
.person-card {
  display: flex;
  gap: 16px;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.person-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gradient-purple);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.3s ease;
}

.person-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--glass-border-light);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.person-card:hover::before {
  transform: scaleY(1);
}

.person-card.selected {
  background: rgba(147, 51, 234, 0.1);
  border-color: rgba(147, 51, 234, 0.3);
  box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.2);
}

.person-card.selected::before {
  transform: scaleY(1);
  width: 6px;
}

/* Avatar */
.person-card .avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  color: white;
  position: relative;
  flex-shrink: 0;
  transition: var(--transition-bounce);
}

.person-card[data-gender="male"] .avatar {
  background: var(--gradient-blue);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.person-card[data-gender="female"] .avatar {
  background: var(--gradient-pink);
  box-shadow: 0 4px 16px rgba(236, 72, 153, 0.3);
}

.person-card[data-gender="unknown"] .avatar {
  background: var(--gradient-purple);
  box-shadow: 0 4px 16px rgba(147, 51, 234, 0.3);
}

.person-card:hover .avatar {
  transform: scale(1.1) rotate(-5deg);
}

/* Status indicator */
.person-card .avatar::after {
  content: "";
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  background: #22c55e;
  border-radius: 50%;
  border: 3px solid var(--bg-base);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.5);
}

/* Person info */
.person-card .meta {
  flex: 1;
  min-width: 0;
}

.person-card .name {
  font-weight: 600;
  font-size: 18px;
  margin-bottom: 4px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-card .sub {
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Family info badges */
.family-info {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.family-badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.family-badge.parents {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.2);
  color: rgba(147, 197, 253, 0.9);
}

.family-badge.children {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.2);
  color: rgba(134, 239, 172, 0.9);
}

.family-badge.spouse {
  background: rgba(236, 72, 153, 0.1);
  border-color: rgba(236, 72, 153, 0.2);
  color: rgba(252, 165, 203, 0.9);
}

/* ========================================
   EDITOR
   ======================================== */
.editor-card {
  position: sticky;
  top: 100px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(var(--glass-blur-heavy));
  -webkit-backdrop-filter: blur(var(--glass-blur-heavy));
}

.editor-card h3 {
  margin: 0 0 20px 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Editor header row: tabs + primary actions */
.editor-header-row {
  display: flex;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 20px;
}

/* Editor tabs */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid var(--glass-border);
}

/* When tabs are inside header row, remove extra bottom margin */
.editor-header-row .tabs {
  flex: 1;
  margin-bottom: 0;
}

.editor-actions-top {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 180px;
}

.editor-actions-top .btn {
  width: 100%;
}

.tab-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
  flex: 1;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: white;
  background: var(--gradient-purple);
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

/* Form grid */
.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
}

/* File upload button styling */
.form-row button[onclick*="f_photo"] {
  background: rgba(255, 255, 255, 0.05);
  border: 2px dashed var(--glass-border);
  transition: var(--transition-smooth);
}

.form-row button[onclick*="f_photo"]:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--glass-border-light);
  border-style: solid;
}

@media (max-width: 480px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-row {
  display: grid;
  gap: 8px;
}

.form-row label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Legacy bottom actions (no longer used in new editor layout) */
.actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--glass-border);
}

@media (max-width: 768px) {
  .editor-header-row {
    flex-direction: column;
  }

  .editor-actions-top {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .editor-actions-top .btn {
    flex: 1 1 100%;
  }
}

/* ========================================
   FAMILY RELATIONS
   ======================================== */
.family-relations {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.relation-section {
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 20px;
  transition: var(--transition-smooth);
}

.relation-section:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--glass-border-light);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.relation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--glass-border);
}

.relation-header h4 {
  margin: 0;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
}

.relation-count {
  background: var(--gradient-purple);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  min-width: 24px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(147, 51, 234, 0.3);
}

.relation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  transition: var(--transition-smooth);
  margin-bottom: 8px;
}

.relation-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--glass-border-light);
  transform: translateX(4px);
}

.relation-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--gradient-purple);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(147, 51, 234, 0.3);
}

.relation-remove {
  appearance: none;
  border: none;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.relation-remove:hover {
  background: rgba(239, 68, 68, 0.2);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Empty state */
.empty-state {
  color: var(--text-muted);
  text-align: center;
  padding: 60px 20px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px dashed var(--glass-border);
  line-height: 1.8;
  font-size: 16px;
}

.empty-relation {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--glass-border);
  border-radius: 12px;
  font-size: 14px;
}

/* ========================================
   MODALS
   ======================================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.3s ease-out;
}

.modal-content {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(var(--glass-blur-heavy));
  -webkit-backdrop-filter: blur(var(--glass-blur-heavy));
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 32px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideInUp 0.4s ease-out;
}

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

.modal-header h3 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: var(--transition-smooth);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

/* ========================================
   NOTIFICATIONS
   ======================================== */
.notification {
  position: fixed;
  top: 100px;
  right: 24px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(var(--glass-blur-heavy));
  -webkit-backdrop-filter: blur(var(--glass-blur-heavy));
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  z-index: 1100;
  animation: slideInFromRight 0.4s ease-out;
  max-width: 360px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.notification:hover {
  transform: translateX(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.notification.success {
  border-left: 4px solid #22c55e;
  background: rgba(34, 197, 94, 0.1);
}

.notification.error {
  border-left: 4px solid #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.notification.warning {
  border-left: 4px solid #fb923c;
  background: rgba(251, 146, 60, 0.1);
}

/* ========================================
   LOADING
   ======================================== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-spinner {
  width: 64px;
  height: 64px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top: 4px solid var(--gradient-purple);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
  background: var(--gradient-purple);
  box-shadow: 0 4px 20px rgba(147, 51, 234, 0.5);
}

.loading-text {
  text-align: center;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 16px;
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 16px rgba(147, 51, 234, 0.3);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(147, 51, 234, 0.5);
  }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 768px) {
  .app-header {
    padding: 16px 20px;
  }
  
  .app-main {
    padding: 16px;
  }
  
  .toolbar {
    flex-direction: column;
    gap: 12px;
  }
  
  .toolbar .btn {
    width: 100%;
  }
  
  .cards-grid {
    grid-template-columns: 1fr;
  }
  
  .modal-content {
    padding: 24px;
    margin: 16px;
  }
  
  .notification {
    left: 16px;
    right: 16px;
    top: 16px;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .app-header h1 {
    font-size: 20px;
  }
  
  .card {
    padding: 20px;
    border-radius: 20px;
  }
  
  .person-card {
    padding: 16px;
  }
  
  .person-card .avatar {
    width: 48px;
    height: 48px;
    font-size: 18px;
  }
  
  .person-card .name {
    font-size: 16px;
  }
  
  .modal-content.editor-modal {
    max-width: 100%;
    height: 100vh;
    border-radius: 0;
    margin: 0;
  }
}

/* Dark scrollbar for webkit browsers */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) rgba(255, 255, 255, 0.02);
}
