/* ========================================
   fujiigo Voice Samples - Design System
   ======================================== */

:root {
  /* Colors */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --bg-glass: rgba(255, 255, 255, 0.06);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);

  --text-primary: #f0f0f5;
  --text-secondary: #8888a0;
  --text-muted: #55556a;

  --accent: #7c5bf5;
  --accent-light: #a78bfa;
  --accent-glow: rgba(124, 91, 245, 0.3);
  --accent-gradient: linear-gradient(135deg, #7c5bf5, #a78bfa, #c084fc);

  --success: #34d399;
  --error: #f87171;
  --warning: #fbbf24;

  /* Typography */
  --font-main: 'Inter', 'Noto Sans JP', -apple-system, sans-serif;

  /* Spacing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.25s;
}

/* ========================================
   Reset & Base
   ======================================== */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 100px;
}

/* ========================================
   Header
   ======================================== */

.header {
  position: relative;
  padding: 3rem 2rem 2rem;
  text-align: center;
  overflow: hidden;
}

.header-inner {
  position: relative;
  z-index: 1;
}

.header-glow {
  position: absolute;
  top: -60%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, var(--accent-glow), transparent 70%);
  pointer-events: none;
  opacity: 0.6;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.logo-icon {
  font-size: 2rem;
  animation: float 3s ease-in-out infinite;
}

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

.logo h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.logo-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding-top: 0.5rem;
}

/* ========================================
   Main Content
   ======================================== */

.main {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container {
  width: 100%;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 0 0.25rem;
}

.sample-count {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ========================================
   Tag Filter & Tags
   ======================================== */

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0 0.25rem;
}

.tag-btn {
  padding: 0.35rem 0.85rem;
  border-radius: 50px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
}

.tag-btn:hover {
  border-color: var(--accent);
  color: var(--accent-light);
}

.tag-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.sample-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.25rem;
}

.sample-tag {
  font-size: 0.65rem;
  padding: 0.1rem 0.5rem;
  border-radius: 50px;
  background: rgba(124, 91, 245, 0.12);
  color: var(--accent-light);
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.sample-tag:hover {
  background: var(--accent);
  color: white;
}

/* Admin tag input */
.tag-input-group {
  margin-bottom: 1.5rem;
}

.tag-input-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  display: block;
}

.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  min-height: 42px;
  align-items: center;
  cursor: text;
  transition: border-color var(--duration) var(--ease);
}

.tag-input-wrap:focus-within {
  border-color: var(--accent);
}

.tag-chip {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 50px;
  background: rgba(124, 91, 245, 0.15);
  color: var(--accent-light);
  font-size: 0.78rem;
  font-weight: 500;
}

.tag-chip-remove {
  cursor: pointer;
  opacity: 0.6;
  font-size: 0.9rem;
  line-height: 1;
  transition: opacity var(--duration) var(--ease);
}

.tag-chip-remove:hover {
  opacity: 1;
}

.tag-input-field {
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.85rem;
  outline: none;
  flex: 1;
  min-width: 80px;
}

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

.admin-sample-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.2rem;
}

.admin-tag {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 50px;
  background: rgba(124, 91, 245, 0.12);
  color: var(--accent-light);
}

.tag-edit-panel {
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  margin-top: -0.5rem;
}

/* ========================================
   Sample List
   ======================================== */

.sample-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sample-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  position: relative;
  overflow: hidden;
}

.sample-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
}

.sample-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.sample-item:hover::before {
  opacity: 0.03;
}

.sample-item.active {
  border-color: var(--accent);
  background: rgba(124, 91, 245, 0.08);
}

.sample-item.active .sample-index {
  color: var(--accent-light);
}

.sample-index {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  min-width: 1.5rem;
  text-align: center;
  position: relative;
  z-index: 1;
}

.btn-play {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--bg-glass);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration) var(--ease);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.btn-play:hover {
  background: var(--accent);
  transform: scale(1.1);
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-play.playing {
  background: var(--accent);
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 10px var(--accent-glow); }
  50% { box-shadow: 0 0 25px var(--accent-glow); }
}

.sample-info {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.sample-filename {
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sample-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.sample-description {
  font-size: 0.82rem;
  color: #e2ddf8;
  margin-top: 0.2rem;
  line-height: 1.4;
}

.new-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.45rem;
  border-radius: 50px;
  background: linear-gradient(135deg, #f472b6, #fb923c);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  vertical-align: middle;
  animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.btn-share {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: all var(--duration) var(--ease);
}

.btn-share:hover {
  color: var(--accent-light);
  background: var(--bg-glass);
}

/* ========================================
   Loading & Empty States
   ======================================== */

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 0;
  gap: 1rem;
  color: var(--text-secondary);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 0;
  gap: 1rem;
}

.empty-icon {
  font-size: 3rem;
  opacity: 0.5;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ========================================
   Global Player (Bottom Bar)
   ======================================== */

.global-player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  padding: 0.75rem 1.5rem;
  z-index: 100;
  transform: translateY(100%);
  transition: transform 0.4s var(--ease);
}

.global-player.visible {
  transform: translateY(0);
}

.player-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.player-info {
  min-width: 0;
  flex: 0 1 200px;
}

.player-filename {
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-player {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration) var(--ease);
}

.btn-player:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
}

.btn-play-global {
  width: 42px;
  height: 42px;
  background: var(--accent);
  color: white;
}

.btn-play-global:hover {
  background: var(--accent-light);
  color: white;
  transform: scale(1.05);
}

.player-progress {
  flex: 1;
  min-width: 0;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border-subtle);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  transition: height 0.15s var(--ease);
}

.progress-bar:hover {
  height: 6px;
}

.progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
}

.time-display {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ========================================
   Footer
   ======================================== */

.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ========================================
   Admin Page Styles
   ======================================== */

.admin-wrap {
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.auth-container {
  max-width: 400px;
  margin: 6rem auto;
  text-align: center;
}

.auth-container h2 {
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.auth-container p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.input-group {
  display: flex;
  gap: 0.5rem;
}

.input-field {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--duration) var(--ease);
}

.input-field:focus {
  border-color: var(--accent);
}

.btn {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent);
  color: white;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.btn:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
}

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

.btn-danger {
  background: transparent;
  color: var(--error);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.1);
}

.auth-error {
  color: var(--error);
  font-size: 0.85rem;
  margin-top: 0.75rem;
  display: none;
}

/* Upload Area */
.upload-section {
  display: none;
}

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

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.upload-dropzone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 3rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  margin-bottom: 2rem;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: var(--accent);
  background: rgba(124, 91, 245, 0.05);
}

.upload-dropzone .drop-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.upload-dropzone p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.upload-dropzone .drop-formats {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.upload-progress {
  display: none;
  margin-bottom: 1.5rem;
}

.upload-progress.visible {
  display: block;
}

.upload-progress-bar {
  height: 4px;
  background: var(--border-subtle);
  border-radius: 2px;
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s var(--ease);
}

.upload-status {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  text-align: center;
}

/* Admin Sample List */
.admin-sample-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  transition: all var(--duration) var(--ease);
}

.admin-sample-item:hover {
  border-color: var(--border-hover);
}

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

.admin-sample-name {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-sample-date {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.toast {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 200;
  transform: translateX(120%);
  transition: transform 0.3s var(--ease);
}

.toast.visible {
  transform: translateX(0);
}

.toast.success {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.toast.error {
  background: rgba(248, 113, 113, 0.15);
  color: var(--error);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 640px) {
  .header {
    padding: 2rem 1rem 1.5rem;
  }

  .logo h1 {
    font-size: 1.8rem;
  }

  .logo-sub {
    font-size: 0.75rem;
  }

  .sample-item {
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }

  .btn-play {
    width: 36px;
    height: 36px;
  }

  .player-inner {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .player-info {
    order: 1;
    flex: 1;
  }

  .player-controls {
    order: 2;
  }

  .player-progress {
    order: 3;
    flex: 0 0 100%;
  }

  .sample-index {
    display: none;
  }

  .auth-container {
    margin: 3rem auto;
    padding: 0 1rem;
  }

  .input-group {
    flex-direction: column;
  }
}
