/* DidISend - Share Memory Tracker */
/* Design System */
:root {
  /* Colors - Warm, Friendly Palette */
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  
  /* Neutrals */
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-alt: #f3f4f6;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  
  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;
  
  /* Effects */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
  
  /* Safe Areas */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111827;
    --surface: #1f2937;
    --surface-alt: #374151;
    --border: #374151;
    --text: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
  }
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* App Container */
.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding-top: var(--safe-top);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--surface-alt);
  border-radius: var(--radius-full);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, background 0.2s;
}

.icon-btn:hover {
  background: var(--border);
  transform: scale(1.05);
}

/* Main Content */
.main {
  flex: 1;
  padding: var(--space-md);
  padding-bottom: calc(80px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* Check Section */
.check-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
}

.input-group {
  display: flex;
  gap: var(--space-sm);
}

.input-group input {
  flex: 1;
  height: 48px;
  padding: 0 var(--space-md);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s;
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary);
}

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

.check-btn {
  height: 48px;
  padding: 0 var(--space-lg);
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.check-btn:hover {
  background: var(--primary-dark);
}

.check-btn:active {
  transform: scale(0.98);
}

.helper-text {
  margin-top: var(--space-sm);
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
}

/* Results Section */
.results-section {
  display: none;
}

.results-section.visible {
  display: block;
}

.result-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
}

.result-card.found {
  border-left: 4px solid var(--warning);
}

.result-card.not-found {
  border-left: 4px solid var(--success);
}

.result-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.result-icon {
  font-size: 1.5rem;
}

.result-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.result-url {
  font-size: 0.875rem;
  color: var(--text-muted);
  word-break: break-all;
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
}

.share-history {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.share-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
}

.share-contact {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.contact-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
}

.contact-name {
  font-weight: 500;
}

.share-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Share Action */
.share-action {
  display: flex;
  justify-content: center;
}

.primary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  height: 52px;
  padding: 0 var(--space-xl);
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}

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

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

.btn-icon {
  font-size: 1.25rem;
}

/* Recent Section */
.recent-section h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.recent-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.2s;
}

.recent-item:hover {
  transform: translateX(4px);
}

.recent-thumbnail {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.recent-info {
  flex: 1;
  min-width: 0;
}

.recent-title {
  font-weight: 500;
  margin-bottom: var(--space-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.recent-contacts {
  display: flex;
  gap: -8px;
}

.recent-contacts .contact-avatar {
  width: 24px;
  height: 24px;
  font-size: 0.625rem;
  margin-left: -8px;
  border: 2px solid var(--surface);
}

.recent-contacts .contact-avatar:first-child {
  margin-left: 0;
}

/* Stats Section */
.stats-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: var(--space-sm) 0;
  padding-bottom: calc(var(--space-sm) + var(--safe-bottom));
  max-width: 430px;
  margin: 0 auto;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
}

.nav-item.active {
  color: var(--primary);
}

.nav-icon {
  font-size: 1.25rem;
}

.nav-label {
  font-size: 0.625rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.modal.visible {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  width: 100%;
  max-width: 430px;
  max-height: 90vh;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
  overflow-y: auto;
}

.modal.visible .modal-content {
  transform: translateY(0);
}

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

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.close-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--surface-alt);
  border-radius: var(--radius-full);
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.modal-body {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  padding-bottom: calc(var(--space-lg) + var(--safe-bottom));
}

/* Form Elements */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input {
  height: 48px;
  padding: 0 var(--space-md);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Contact Chips */
.contact-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.chip {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-alt);
  border: 2px solid transparent;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.chip:hover {
  background: var(--border);
}

.chip.selected {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--primary);
  color: var(--primary);
}

.chip-avatar {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 600;
}

.full-width {
  width: 100%;
}

/* Alert */
.alert {
  position: fixed;
  top: var(--space-md);
  left: var(--space-md);
  right: var(--space-md);
  max-width: 400px;
  margin: 0 auto;
  z-index: 1100;
  transform: translateY(-120%);
  transition: transform 0.3s ease-out;
}

.alert.visible {
  transform: translateY(calc(var(--safe-top) + var(--space-md)));
}

.alert-content {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--warning);
  color: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.alert-icon {
  font-size: 1.5rem;
}

.alert-text {
  flex: 1;
}

.alert-text strong {
  display: block;
  margin-bottom: var(--space-xs);
}

.alert-text p {
  font-size: 0.875rem;
  opacity: 0.9;
}

.alert-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.alert-close:hover {
  opacity: 1;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-xl);
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

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

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

.result-card {
  animation: slideUp 0.3s ease-out;
}

.recent-item {
  animation: fadeIn 0.3s ease-out;
}

/* Responsive */
@media (min-width: 430px) {
  .app {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}
