/* === Reset & Base === */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f5f7fa;
  color: #333333;
  line-height: 1.6;
  min-height: 100vh;
}

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

img {
  max-width: 100%;
  display: block;
}

/* === Logo === */
.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: #f47920;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

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

.btn-tiktok {
  background: #1a2332;
  color: #ffffff;
  font-size: 1.125rem;
  padding: 1rem 2rem;
  border-radius: 12px;
}

.btn-tiktok:hover {
  background: #f47920;
}

.btn-secondary {
  background: #f47920;
  color: #ffffff;
}

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

.tiktok-icon {
  flex-shrink: 0;
}

/* === Landing Page === */
.landing {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.landing-header {
  padding: 1.25rem 2rem;
}

.landing-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.landing-title {
  font-size: 2.5rem;
  color: #1a2332;
  margin-bottom: 0.5rem;
}

.landing-subtitle {
  font-size: 1.25rem;
  color: #f47920;
  margin-bottom: 1rem;
}

.landing-description {
  max-width: 480px;
  color: #555;
  margin-bottom: 2rem;
}

.landing-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.85rem;
  color: #999;
}

/* === Dashboard === */
.dashboard {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
}

.dashboard-nav {
  display: flex;
  gap: 1rem;
}

.nav-link {
  font-weight: 500;
  color: #1a2332;
  transition: color 0.2s;
}

.nav-link:hover {
  color: #f47920;
}

.nav-link--logout {
  color: #999;
}

/* === Loading === */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 0;
  gap: 1rem;
  color: #999;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e0e0e0;
  border-top-color: #f47920;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* === Error === */
.error-message {
  text-align: center;
  padding: 3rem 1rem;
  color: #c0392b;
}

.error-message .btn {
  margin-top: 1rem;
}

/* === Profile Card === */
.profile-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: #ffffff;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.profile-avatar-wrap {
  flex-shrink: 0;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  background: #e0e0e0;
}

.profile-name {
  font-size: 1.25rem;
  color: #1a2332;
}

.profile-bio {
  font-size: 0.9rem;
  color: #777;
  margin: 0.25rem 0 0.75rem;
}

.profile-stats {
  display: flex;
  gap: 1.5rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1a2332;
}

.stat-label {
  font-size: 0.75rem;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* === Section Titles === */
.section-title {
  font-size: 1.25rem;
  color: #1a2332;
  margin-bottom: 1rem;
}

/* === Video Grid === */
.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.video-card {
  background: #ffffff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s, box-shadow 0.15s;
}

.video-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.video-cover {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  background: #e0e0e0;
}

.video-body {
  padding: 0.75rem;
}

.video-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1a2332;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem 0.5rem;
  font-size: 0.75rem;
  color: #777;
}

.video-metrics span {
  white-space: nowrap;
}

/* === Leaderboard Table === */
.table-wrap {
  overflow-x: auto;
  margin-bottom: 2.5rem;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 0.75rem 1rem;
  text-align: left;
}

.leaderboard-table thead {
  background: #1a2332;
  color: #ffffff;
}

.leaderboard-table th {
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.leaderboard-table tbody tr {
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
}

.leaderboard-table tbody tr:last-child {
  border-bottom: none;
}

.leaderboard-table tbody tr:hover {
  background: #fdf4ec;
}

.leaderboard-table td {
  font-size: 0.9rem;
}

.leaderboard-rank {
  font-weight: 700;
  color: #f47920;
}

/* === Responsive === */
@media (max-width: 600px) {
  .landing-title {
    font-size: 1.75rem;
  }

  .landing-subtitle {
    font-size: 1rem;
  }

  .profile-card {
    flex-direction: column;
    text-align: center;
  }

  .profile-stats {
    justify-content: center;
  }

  .videos-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .leaderboard-table th,
  .leaderboard-table td {
    padding: 0.5rem 0.6rem;
    font-size: 0.8rem;
  }
}
