/* Aura Battle — Mobile-First Modern Theme (v1.0.0) */

:root {
  --bg-main: #090d16;
  --bg-card: #131b2e;
  --bg-card-hover: #1c2742;
  --bg-header: rgba(15, 23, 42, 0.85);
  --border-color: #263352;
  --border-highlight: #3b82f6;

  --primary: #8b5cf6;
  --primary-hover: #7c3aed;
  --primary-glow: rgba(139, 92, 246, 0.35);

  --accent-pink: #ec4899;
  --accent-amber: #f59e0b;
  --accent-green: #10b981;
  --accent-red: #ef4444;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --nav-height: 64px;
  --header-height: 60px;
  --touch-target: 44px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
}

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

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* App Shell */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

/* Header */
.app-header {
  height: var(--header-height);
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.brand-icon {
  width: 28px;
  height: 28px;
}

.header-user-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.budget-widget {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c084fc;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-badge {
  background: #1e293b;
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
}

/* Main Container */
.main-content {
  flex: 1;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--nav-height) + 24px) 16px;
}

/* Bottom Navigation Bar (Mobile-first) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-target);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-item.active {
  color: #c084fc;
}

.nav-item.active .nav-icon {
  transform: translateY(-2px);
  filter: drop-shadow(0 0 6px var(--primary-glow));
}

.nav-icon {
  font-size: 20px;
  margin-bottom: 2px;
  transition: transform 0.15s ease;
}

/* Floating Action Button (Give Aura) */
.fab-give-aura {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  right: 16px;
  z-index: 45;
  background: linear-gradient(135deg, var(--primary), var(--accent-pink));
  color: white;
  border: none;
  border-radius: 28px;
  padding: 12px 20px;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
  cursor: pointer;
  min-height: var(--touch-target);
  transition: transform 0.15s ease;
}

.fab-give-aura:active {
  transform: scale(0.96);
}

/* Cards & Sections */
.view-section {
  display: none;
  animation: fadeIn 0.2s ease;
}

.view-section.active {
  display: block;
}

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

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Feed List */
.vote-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  position: relative;
  transition: border-color 0.15s ease;
}

.vote-card:hover {
  border-color: #3b4e7a;
}

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

.vote-participants {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.nick {
  font-weight: 700;
  color: var(--text-main);
}

.arrow-icon {
  color: var(--text-dim);
}

.score-badge {
  font-weight: 800;
  font-size: 14px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
}

.score-positive {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.score-negative {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.vote-comment {
  font-size: 14px;
  color: #e2e8f0;
  line-height: 1.45;
  background: rgba(15, 23, 42, 0.4);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  word-break: break-word;
}

.vote-comment.moderated {
  color: var(--text-dim);
  font-style: italic;
}

.vote-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-dim);
}

.vote-actions {
  display: flex;
  gap: 8px;
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

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

.btn-text.danger {
  color: #f87171;
}

/* Leaderboard */
.leaderboard-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}

.select-custom {
  background: #1e293b;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  min-height: var(--touch-target);
  outline: none;
  cursor: pointer;
}

/* Podium */
.podium-container {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 12px;
  margin: 24px 0;
  padding: 10px 0;
}

.podium-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 140px;
}

.podium-card {
  width: 100%;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  text-align: center;
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.podium-first {
  height: 120px;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.3), rgba(245, 158, 11, 0.05));
  border: 2px solid #f59e0b;
  order: 2;
}

.podium-second {
  height: 95px;
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.25), rgba(148, 163, 184, 0.05));
  border: 2px solid #94a3b8;
  order: 1;
}

.podium-third {
  height: 80px;
  background: linear-gradient(180deg, rgba(202, 138, 4, 0.25), rgba(202, 138, 4, 0.05));
  border: 2px solid #ca8a04;
  order: 3;
}

.podium-rank {
  font-size: 24px;
  margin-bottom: 4px;
}

.podium-nickname {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90%;
}

.podium-score {
  font-size: 13px;
  font-weight: 800;
  color: #c084fc;
}

/* Leaderboard List */
.ranking-table {
  width: 100%;
  border-collapse: collapse;
}

.ranking-table tr {
  border-bottom: 1px solid var(--border-color);
}

.ranking-table td {
  padding: 12px 8px;
  font-size: 14px;
}

.rank-num {
  font-weight: 800;
  color: var(--text-dim);
  width: 32px;
}

/* Media Gallery */
.category-filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}

.cat-chip {
  background: #1e293b;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
}

.cat-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.media-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.media-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: #000;
}

.media-info {
  padding: 8px;
  font-size: 11px;
}

.media-cat-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #c084fc;
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  animation: modalScale 0.2s ease;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

/* Form Controls */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  background: #1e293b;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  min-height: var(--touch-target);
  transition: border-color 0.15s ease;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--primary);
}

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

.char-counter {
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
  margin-top: 4px;
}

/* Score Pills Selector */
.score-picker {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.quick-scores {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-score-btn {
  background: #1e293b;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  min-height: var(--touch-target);
  min-width: var(--touch-target);
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-score-btn.positive {
  color: #34d399;
}

.quick-score-btn.negative {
  color: #f87171;
}

.quick-score-btn.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Primary Button */
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), var(--accent-pink));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  min-height: var(--touch-target);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.15s ease;
}

.btn-primary:active {
  opacity: 0.9;
}

.btn-secondary {
  background: #1e293b;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  min-height: var(--touch-target);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 360px;
}

.toast {
  background: #1e293b;
  border: 1px solid var(--border-color);
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  animation: slideToast 0.25s ease;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.success {
  border-color: #10b981;
  background: #064e3b;
}

.toast.error {
  border-color: #ef4444;
  background: #7f1d1d;
}

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

/* Admin Panel Styles */
.admin-subnav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 16px;
  padding-bottom: 6px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th, .admin-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.admin-table th {
  color: var(--text-dim);
  font-weight: 600;
}

/* Desktop layout enhancements (>= 768px) */
@media (min-width: 768px) {
  .app-header {
    padding: 0 32px;
  }
  .main-content {
    max-width: 840px;
    padding: 24px 24px calc(var(--nav-height) + 32px) 24px;
  }
  .bottom-nav {
    max-width: 600px;
    margin: 0 auto;
    border-radius: 20px 20px 0 0;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
  }
}
