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

:root {
  /* Brand Colors */
  --brand-50: #eeedfe;
  --brand-100: #ceCBF6;
  --brand-300: #afa9ec;
  --brand-500: #534ab7;
  --brand-700: #3c3489;
  --brand-900: #26215c;
  
  /* Neutral Colors */
  --bg-color: #f8f9fa;
  --surface-color: #ffffff;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border-color: #e5e7eb;

  /* State Colors */
  --success-color: #10b981;
  --success-bg: #d1fae5;
  --danger-color: #ef4444;
  --danger-bg: #fee2e2;
  --warning-color: #f59e0b;
  --warning-bg: #fef3c7;

  /* Safe areas for iOS native feel */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);

  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
  --border-radius-xl: 32px;

  --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-float: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #111827;
    --surface-color: #1f2937;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --border-color: #374151;
  }
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

button, input, select {
  font-family: inherit;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
}

/* Utilities */
.container {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.text-center { text-align: center; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-8 { margin-bottom: 2rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  border-radius: var(--border-radius-md);
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.btn-primary {
  background-color: var(--brand-700);
  color: white;
  box-shadow: 0 4px 14px rgba(60, 52, 137, 0.39);
}

.btn-primary:hover {
  background-color: var(--brand-900);
  box-shadow: 0 6px 20px rgba(60, 52, 137, 0.23);
}

.btn-secondary {
  background-color: var(--brand-50);
  color: var(--brand-900);
}

.btn-secondary:hover {
  background-color: var(--brand-100);
}

.btn-success {
  background-color: var(--success-color);
  color: white;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.39);
}

.btn-block {
  width: 100%;
}

/* Form Elements */
.form-group {
  margin-bottom: 1.25rem;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 0.875rem 1rem;
  border-radius: var(--border-radius-md);
  border: 1.5px solid var(--border-color);
  background-color: var(--surface-color);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.2s;
}

.form-control:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 4px var(--brand-50);
}

/* Cards */
.card {
  background-color: var(--surface-color);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: transform 0.2s, box-shadow 0.2s;
}

/* Top Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding-top: var(--sat);
}

@media (prefers-color-scheme: dark) {
  .app-header {
    background-color: rgba(31, 41, 55, 0.85);
  }
}

.app-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
}

.brand-logo-small {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--brand-900);
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--brand-700);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

@media (prefers-color-scheme: dark) {
  .brand-logo-small { color: white; }
}

/* Layout for App View */
.app-layout {
  display: flex;
  flex: 1;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.app-main {
  flex: 1;
  padding: 1.5rem 1rem calc(var(--sab) + 100px) 1rem;
}

/* Bottom Navigation (Mobile) */
.bottom-nav {
  position: fixed;
  bottom: calc(var(--sab) + 1rem);
  left: 1rem;
  right: 1rem;
  max-width: 500px;
  margin: 0 auto;
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--border-radius-xl);
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  padding: 0.5rem;
  display: flex;
  justify-content: space-around;
  z-index: 50;
  border: 1px solid var(--border-color);
}

@media (prefers-color-scheme: dark) {
  .bottom-nav {
    background-color: rgba(31, 41, 55, 0.9);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  }
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-md);
  color: var(--text-muted);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.65rem;
  font-weight: 600;
  gap: 0.25rem;
}

.nav-item i {
  font-size: 1.25rem;
  transition: transform 0.3s;
}

.nav-item.active {
  color: var(--brand-700);
  background-color: var(--brand-50);
}

.nav-item.active i {
  transform: translateY(-2px);
}

@media (prefers-color-scheme: dark) {
  .nav-item.active {
    color: var(--brand-100);
    background-color: rgba(255,255,255,0.1);
  }
}

/* Desktop Sidebar Adaption */
@media (min-width: 768px) {
  .bottom-nav {
    display: none; /* Hide bottom nav on desktop */
  }
  
  .desktop-sidebar {
    display: flex;
    flex-direction: column;
    width: 250px;
    padding: 2rem 1.5rem;
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
  }

  .desktop-nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--border-radius-md);
    color: var(--text-secondary);
    font-weight: 600;
    transition: all 0.2s;
    margin-bottom: 0.5rem;
  }

  .desktop-nav-item.active {
    background-color: var(--brand-50);
    color: var(--brand-700);
  }

  @media (prefers-color-scheme: dark) {
    .desktop-nav-item.active {
      background-color: rgba(255,255,255,0.1);
      color: var(--brand-100);
    }
  }

  .desktop-nav-item:hover:not(.active) {
    background-color: rgba(0,0,0,0.02);
  }

  .app-layout {
    max-width: 1000px;
  }
}

@media (max-width: 767px) {
  .desktop-sidebar {
    display: none;
  }
}
