/* Tunes.fund - Modern Apple-Inspired Design System */

:root {
  /* Colors - Apple-inspired palette */
  --primary: #0071e3;
  --primary-hover: #0077ed;
  --secondary: #f5f5f7;
  --secondary-dark: #e8e8ed;
  --danger: #ff3b30;
  --danger-hover: #ff453a;
  --text-primary: #000;
  --text-secondary: #666;
  --text-muted: #999;
  --border-light: #e8e8ed;
  --background: #fff;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --transition: all 0.2s ease;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #0a84ff;
    --primary-hover: #147ef5;
    --secondary: #1d1d1f;
    --secondary-dark: #424245;
    --text-primary: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-muted: #666;
    --border-light: #424245;
    --background: #000;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  }
}

/* Base Typography */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--background);
}

/* Typography */
h4.page-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 24px 0;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-hover);
}

/* Navbar Header */
.navbar-header {
  background-color: var(--background);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 40px;
}

.navbar-brand {
  flex: 1;
  min-width: 0;
}

.navbar-brand hgroup {
  margin: 0;
}

.navbar-brand h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.3px;
}

.navbar-brand p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 2px 0 0 0;
}

.navbar-menus {
  display: flex;
  gap: 24px;
  align-items: center;
}

/* Navbar Menu Dropdown */
.navbar-menu {
  position: relative;
}

.navbar-menu-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  font-family: inherit;
}

.navbar-menu-btn:hover {
  color: var(--primary);
}

.navbar-menu-btn svg {
  width: 12px;
  height: 8px;
  transition: var(--transition);
}

.navbar-menu.active .navbar-menu-btn svg {
  transform: rotate(180deg);
}

.navbar-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background-color: var(--background);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  margin-top: 8px;
  min-width: 220px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: var(--transition);
  z-index: 1001;
}

.navbar-menu.active .navbar-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.navbar-dropdown-item {
  display: block;
  padding: 12px 16px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 15px;
  transition: var(--transition);
  border-radius: 6px;
  margin: 2px 8px;
}

.navbar-dropdown-item:first-child {
  margin-top: 8px;
}

.navbar-dropdown-item:last-child {
  margin-bottom: 8px;
}

.navbar-dropdown-item:hover {
  background-color: var(--secondary);
  color: var(--primary);
}

.navbar-dropdown-divider {
  height: 1px;
  background-color: var(--border-light);
  margin: 4px 0;
}

.navbar-dropdown-logout {
  color: var(--danger);
}

.navbar-dropdown-logout:hover {
  background-color: rgba(255, 59, 48, 0.08);
  color: var(--danger-hover);
}

/* Section Styling for Rules/Content Pages */
.tunes-section {
  margin-bottom: 32px;
}

.section-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 16px 0;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.section-content {
  color: var(--text-primary);
  line-height: 1.7;
}

.section-content p {
  margin: 0 0 14px 0;
  font-size: 16px;
}

.section-content p:last-child {
  margin-bottom: 0;
}

/* List Styling */
.tunes-list {
  margin: 14px 0 14px 20px;
  padding: 0;
  list-style: disc;
}

.tunes-list li {
  margin: 8px 0;
  font-size: 16px;
  color: var(--text-primary);
  line-height: 1.6;
}

.tunes-list strong {
  font-weight: 600;
}

/* Example Note Styling */
.example-note {
  background-color: var(--secondary);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 20px;
  margin: 20px 0;
}

.example-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 16px 0;
}

.example-explanation {
  margin: 16px 0 0 0;
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.7;
}

.example-explanation strong {
  font-weight: 600;
  color: var(--text-primary);
}

/* Links in content */
.section-content a,
.example-note a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.section-content a:hover,
.example-note a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Ordered Lists */
.tunes-list[style*="list-style: decimal"],
.section-content ol {
  margin: 14px 0 14px 20px;
  padding: 0;
}

.section-content ol li {
  margin: 8px 0;
  font-size: 16px;
  color: var(--text-primary);
  line-height: 1.6;
}

/* Alert/Status Boxes */
.alert {
  display: flex;
  gap: 16px;
  padding: 16px;
  border-radius: 10px;
  margin-bottom: 24px;
  border: 1px solid var(--border-light);
  animation: slideDown 0.3s ease;
}

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

.alert-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}

.alert-success {
  background-color: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.3);
  color: #059669;
}

.alert-success .alert-icon {
  color: #059669;
}

.alert-info {
  background-color: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--text-primary);
}

.alert-info .alert-icon {
  color: var(--primary);
}

.alert-error {
  background-color: rgba(255, 59, 48, 0.08);
  border-color: rgba(255, 59, 48, 0.3);
  color: var(--danger);
}

.alert-error .alert-icon {
  color: var(--danger);
}

.alert-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: inherit;
}

.alert p {
  font-size: 15px;
  margin: 0;
  line-height: 1.5;
  color: inherit;
}

.alert a {
  color: inherit;
  font-weight: 500;
  border-bottom: 1px solid currentColor;
}

/* Welcome Section */
.welcome-section {
  margin-bottom: 32px;
  text-align: center;
}

.welcome-intro {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 16px 0 0 0;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 0;
}

.feature-card {
  padding: 20px;
  background-color: var(--secondary);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  text-align: center;
  transition: var(--transition);
}

.feature-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.feature-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--text-primary);
}

.feature-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.6;
}

/* Auth Container */
.auth-container {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 32px;
  align-items: stretch;
}

.auth-card {
  padding: 24px;
  background-color: var(--secondary);
  border: 1px solid var(--border-light);
  border-radius: 10px;
}

.auth-divider {
  width: 1px;
  background-color: var(--border-light);
  min-height: 100%;
}

.auth-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--text-primary);
}

.auth-description {
  font-size: 15px;
  color: var(--text-secondary);
  margin: 0 0 16px 0;
  line-height: 1.6;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.form-input {
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-size: 16px;
  background-color: var(--background);
  color: var(--text-primary);
  transition: var(--transition);
  font-family: inherit;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

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

.auth-footer {
  font-size: 14px;
  text-align: center;
  margin: 0;
}

.auth-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* Button Sizes */
.btn-lg {
  padding: 12px 20px;
  font-size: 16px;
  width: 100%;
}

/* Responsive Auth Container */
@media (max-width: 768px) {
  .auth-container {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .auth-divider {
    display: none;
  }

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

/* Section & Container Spacing */
main.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 20px;
}

/* Search Section */
.search-section {
  margin-bottom: 28px;
}

.search-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.search-input {
  flex: 1;
  min-width: 240px;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-size: 16px;
  background-color: var(--background);
  color: var(--text-primary);
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

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

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

/* Button Styles - Apple Design */
.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  border: 1px solid var(--primary);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  opacity: 0.9;
  transform: scale(0.98);
}

.btn-ghost {
  background-color: var(--secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-ghost:hover {
  background-color: var(--secondary-dark);
  border-color: var(--secondary-dark);
}

.btn-danger {
  background-color: var(--danger);
  color: white;
  border: 1px solid var(--danger);
}

.btn-danger:hover {
  background-color: var(--danger-hover);
  border-color: var(--danger-hover);
  box-shadow: var(--shadow-md);
}

.btn-sm {
  padding: 8px 12px;
  font-size: 14px;
}

/* Table Styling - Compact & Professional */
.overflow-auto {
  overflow-x: auto;
  margin-bottom: 28px;
}

.results-wrap {
  border-radius: 10px;
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.playlist-wrap {
  border-radius: 10px;
  border: 1px solid var(--border-light);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--background);
}

/* Table Header */
table.striped thead {
  background-color: var(--secondary);
  border-bottom: 1px solid var(--border-light);
}

table.striped thead th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}

table.striped thead th.center {
  text-align: center;
}

/* Table Body */
table.striped tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
}

table.striped tbody tr:hover {
  background-color: var(--secondary);
}

table.striped tbody td {
  padding: 12px 16px;
  vertical-align: middle;
}

table.striped tbody td.center {
  text-align: center;
}

table.table-compact tbody td {
  padding: 12px 16px;
}

/* Artist Cell */
.artist-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.artist-meta {
  flex: 1;
  min-width: 0;
}

.artist-link {
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
}

.artist-link:hover {
  color: var(--primary);
}

.artist-meta .text-muted {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 2px;
}

.artist-meta .small {
  font-size: 13px;
}

/* Status Note */
.status-note {
  padding: 14px 16px;
  background-color: var(--secondary);
  border-radius: 10px;
  border: 1px solid var(--border-light);
  margin-bottom: 28px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
}

.status-note strong {
  font-weight: 600;
}

.status-note a {
  font-weight: 500;
}

/* Form Styling */
form {
  margin: 0;
}

input[type="hidden"] {
  display: none;
}

/* Text Utilities */
.text-muted {
  color: var(--text-muted);
}

.center {
  text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
  .navbar-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 12px 16px;
  }

  .navbar-brand h1 {
    font-size: 18px;
  }

  .navbar-menus {
    width: 100%;
    gap: 16px;
  }

  .navbar-dropdown {
    position: fixed;
    right: 16px;
    left: 16px;
    width: auto;
  }

  main.container {
    padding: 20px 16px;
  }

  h4.page-title {
    font-size: 22px;
    margin-bottom: 20px;
  }

  .search-form {
    flex-direction: column;
  }

  .search-input {
    width: 100%;
    min-width: unset;
  }

  .search-actions {
    width: 100%;
  }

  .search-actions .btn {
    flex: 1;
  }

  .artist-cell {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .avatar {
    width: 40px;
    height: 40px;
  }

  table.striped thead th,
  table.striped tbody td {
    padding: 10px 12px;
    font-size: 14px;
  }

  .btn {
    padding: 8px 12px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  table.striped thead th.center,
  table.striped tbody td.center {
    text-align: left;
  }

  .btn-sm {
    width: 100%;
  }
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* Focus Visible for Accessibility */
.btn:focus-visible,
.search-input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Animation & Transitions */
@media (prefers-reduced-motion: no-preference) {
  * {
    scroll-behavior: smooth;
  }
}
