/* ─── Base ─────────────────────────────────────────────────── */

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

body {
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: #faf9f7;
  color: #3d3d3d;
  min-height: 100vh;
  padding-bottom: 80px;
  -webkit-font-smoothing: antialiased;
}

/* ─── Header ───────────────────────────────────────────────── */

#app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid #eee;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.header-left h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #e85d26;
  letter-spacing: -0.03em;
}

.tagline {
  color: #a0998f;
  font-size: 0.85rem;
  font-weight: 400;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #e8e4df;
}

.user-name {
  font-size: 0.85rem;
  color: #706b63;
}

/* ─── Nav ─────────────────────────────────────────────────── */

#main-nav {
  display: flex;
  gap: 0.25rem;
  margin-left: 1rem;
}

.nav-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: #706b63;
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover {
  color: #e85d26;
  background: rgba(232, 93, 38, 0.06);
}

.nav-link-active {
  color: #e85d26;
  background: rgba(232, 93, 38, 0.1);
}

/* ─── Buttons ──────────────────────────────────────────────── */

.btn {
  border: none;
  border-radius: 10px;
  padding: 0.55rem 1.15rem;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: #e85d26;
  color: #fff;
  box-shadow: 0 2px 8px rgba(232, 93, 38, 0.25);
}

.btn-primary:hover {
  background: #d14f1c;
  box-shadow: 0 4px 16px rgba(232, 93, 38, 0.3);
}

.btn-secondary {
  background: #eeebe7;
  color: #5a554d;
}

.btn-secondary:hover {
  background: #e2dedb;
}

.btn-small {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

.btn-large {
  padding: 0.85rem 2.25rem;
  font-size: 1rem;
  border-radius: 12px;
}

.btn-danger {
  background: #e84040;
  color: #fff;
}

.btn-danger:hover {
  background: #cf3333;
}

.btn-record {
  background: #fff;
  color: #e84040;
  border: 2px solid #eee;
  padding: 0.6rem 1.2rem;
}

.btn-record:hover {
  border-color: #e84040;
}

.btn-record.recording {
  border-color: #e84040;
  animation: pulse-border 1.5s ease-in-out infinite;
}

.record-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e84040;
  display: inline-block;
}

.btn-record.recording .record-dot {
  animation: pulse-dot 1s ease-in-out infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: #e84040; }
  50% { border-color: #f5b3b3; }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.btn-logout {
  background: transparent;
  color: #a0998f;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

.btn-logout:hover {
  color: #706b63;
}

/* ─── Landing / Auth Section ──────────────────────────────── */

#auth-section,
#page-home {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 60px);
  padding: 2rem;
}

.landing {
  max-width: 960px;
  width: 100%;
}

.landing-hero {
  display: flex;
  align-items: center;
  gap: 4rem;
  padding: 3rem 0 4rem;
}

.landing-hero-text {
  flex: 1;
}

.landing-hero-text h2 {
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: #2a2a2a;
  margin-bottom: 1rem;
}

.landing-hero-text p {
  color: #7a756d;
  font-size: 1.1rem;
  line-height: 1.7;
  margin-bottom: 2rem;
  max-width: 420px;
}

.landing-hero-art {
  flex: 0 0 280px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.art-circles {
  position: relative;
  width: 240px;
  height: 240px;
}

.art-circle {
  position: absolute;
  border-radius: 50%;
  animation: float 6s ease-in-out infinite;
}

.art-circle-1 {
  width: 180px;
  height: 180px;
  background: linear-gradient(135deg, #fde1c8, #f8c291);
  top: 10px;
  left: 10px;
  opacity: 0.7;
  animation-delay: 0s;
}

.art-circle-2 {
  width: 140px;
  height: 140px;
  background: linear-gradient(135deg, #e85d26, #f09764);
  top: 60px;
  left: 80px;
  opacity: 0.6;
  animation-delay: -2s;
}

.art-circle-3 {
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, #fcebd5, #f5d6b8);
  top: 20px;
  left: 120px;
  opacity: 0.8;
  animation-delay: -4s;
}

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

/* ─── Feature Cards ──────────────────────────────────────── */

.landing-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  padding-top: 1rem;
}

.feature-card {
  background: #fff;
  border-radius: 16px;
  padding: 2rem 1.5rem;
  text-align: center;
  border: 1px solid #f0ede8;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}

.feature-icon {
  font-size: 2.25rem;
  margin-bottom: 0.75rem;
}

.feature-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #2a2a2a;
  margin-bottom: 0.5rem;
}

.feature-card p {
  font-size: 0.9rem;
  color: #8a847b;
  line-height: 1.6;
}

.btn-feature-action {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.85rem;
  text-decoration: none;
}

/* ─── Cards ────────────────────────────────────────────────── */

.card {
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  margin: 1.5rem;
  border: 1px solid #f0ede8;
}

.card h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: #2a2a2a;
}

/* ─── Forms ────────────────────────────────────────────────── */

.input {
  width: 100%;
  background: #faf9f7;
  border: 1px solid #e2dedb;
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  color: #3d3d3d;
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input:focus {
  outline: none;
  border-color: #e85d26;
  box-shadow: 0 0 0 3px rgba(232, 93, 38, 0.1);
}

.input::placeholder {
  color: #bbb5ac;
}

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

.clip-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.record-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-text {
  font-size: 0.85rem;
  color: #a0998f;
}

audio#audio-preview {
  width: 100%;
  margin-top: 0.75rem;
  height: 36px;
}

/* ─── Browse ───────────────────────────────────────────────── */

#browse-panel {
  padding: 1.5rem 2rem;
}

.browse-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.browse-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #2a2a2a;
}

.search-bar {
  flex: 1;
  max-width: 320px;
}

.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tag-chip {
  background: #f0ede8;
  color: #706b63;
  border: none;
  border-radius: 9999px;
  padding: 0.3rem 0.85rem;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.tag-chip:hover, .tag-chip.active {
  background: #e85d26;
  color: #fff;
}

/* ─── Clips Grid ───────────────────────────────────────────── */

.clips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.clip-card {
  background: #fff;
  border-radius: 14px;
  padding: 1.25rem;
  border: 1px solid #f0ede8;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.clip-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.clip-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.clip-title {
  font-size: 1rem;
  font-weight: 600;
  color: #2a2a2a;
  margin-bottom: 0.25rem;
}

.clip-author {
  font-size: 0.8rem;
  color: #a0998f;
  margin-bottom: 0.5rem;
}

.clip-desc {
  font-size: 0.85rem;
  color: #706b63;
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.clip-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.clip-card-tag {
  background: #f5f2ed;
  color: #8a847b;
  border-radius: 9999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
}

.clip-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.clip-card-date {
  font-size: 0.75rem;
  color: #bbb5ac;
}

.clip-card-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-play {
  background: #e85d26;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.45rem 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  transition: background 0.15s, transform 0.15s;
}

.btn-play:hover {
  background: #d14f1c;
  transform: translateY(-1px);
}

/* ─── Empty State ──────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #bbb5ac;
}

/* ─── Player Bar ───────────────────────────────────────────── */

.player-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid #eee;
  padding: 0.5rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 200;
}

.player-info {
  display: flex;
  flex-direction: column;
  min-width: 120px;
}

.player-clip-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #2a2a2a;
}

.player-user-name {
  font-size: 0.75rem;
  color: #a0998f;
}

.player-bar audio {
  flex: 1;
  height: 32px;
}

/* ─── Utility ──────────────────────────────────────────────── */

.hidden {
  display: none !important;
}

/* ─── Responsive ───────────────────────────────────────────── */

@media (max-width: 768px) {
  .landing-hero {
    flex-direction: column;
    gap: 2rem;
    text-align: center;
    padding: 2rem 0 3rem;
  }

  .landing-hero-text h2 {
    font-size: 2rem;
  }

  .landing-hero-text p {
    max-width: 100%;
  }

  .landing-hero-art {
    flex: 0 0 auto;
  }

  .art-circles {
    width: 180px;
    height: 180px;
  }

  .art-circle-1 {
    width: 130px;
    height: 130px;
  }

  .art-circle-2 {
    width: 100px;
    height: 100px;
    top: 50px;
    left: 60px;
  }

  .art-circle-3 {
    width: 70px;
    height: 70px;
    top: 15px;
    left: 90px;
  }

  .landing-features {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

@media (max-width: 640px) {
  #app-header {
    padding: 1rem 1.25rem;
  }

  .header-left h1 {
    font-size: 1.2rem;
  }

  .tagline {
    display: none;
  }

  .clips-grid {
    grid-template-columns: 1fr;
  }

  .browse-header {
    flex-direction: column;
    align-items: stretch;
  }

  .search-bar {
    max-width: 100%;
  }

  #browse-panel {
    padding: 1.25rem;
  }

  .player-bar {
    padding: 0.5rem 1.25rem;
  }
}

/* Upload loading state */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.1rem;
  height: 1.1rem;
  margin: -0.55rem 0 0 -0.55rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}

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