/* ==========================================================================
   Kivo Stats Tracker - Styles
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Variables
   -------------------------------------------------------------------------- */
:root {
  --bg-color: #09090b;
  --card-bg: #18181b;
  --card-bg-hover: #27272a;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --accent-color: #f97316;
  --accent-glow: rgba(249, 115, 22, 0.15);
  --border-color: #27272a;
  --border-color-hover: #3f3f46;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
  --radius: 16px;
  --radius-sm: 12px;
  --transition: 0.2s ease;
  --transition-slow: 0.3s ease;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

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

img {
  max-width: 100%;
  height: auto;
}

/* --------------------------------------------------------------------------
   Homepage
   -------------------------------------------------------------------------- */
.homepage {
  min-height: 100vh;
  padding: 4rem 1.5rem;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 4rem;
}

.header__title {
  font-size: 3rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.header__tagline {
  font-size: 1.125rem;
  color: var(--text-secondary);
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* Card */
.card {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.75rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  cursor: pointer;
  transition:
    transform var(--transition),
    background-color var(--transition),
    border-color var(--transition),
    box-shadow var(--transition-slow);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-glow) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition-slow);
}

.card:hover {
  transform: translateY(-2px);
  background: var(--card-bg-hover);
  border-color: var(--border-color-hover);
  box-shadow: var(--shadow-md);
}

.card:hover::before {
  opacity: 1;
}

.card:active {
  transform: translateY(0);
}

.card__logo {
  position: relative;
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.5rem;
}

.card__content {
  position: relative;
  flex: 1;
  min-width: 0;
}

.card__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__arrow {
  position: relative;
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition:
    transform var(--transition),
    color var(--transition);
}

.card:hover .card__arrow {
  transform: translateX(4px);
  color: var(--accent-color);
}

/* --------------------------------------------------------------------------
   Dashboard Page
   -------------------------------------------------------------------------- */
.dashboard-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Dashboard Header */
.dashboard-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.dashboard-header__back {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent-color);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: opacity var(--transition);
}

.dashboard-header__back:hover {
  opacity: 0.7;
}

.dashboard-header__back svg {
  width: 20px;
  height: 20px;
}

.dashboard-header__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-left: auto;
  margin-right: auto;
  padding-right: 80px; /* Balance the back button */
}

/* Dashboard Iframe Container */
.dashboard-iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: var(--bg-color);
}

/* --------------------------------------------------------------------------
   404 Page
   -------------------------------------------------------------------------- */
.not-found {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
  padding: 2rem;
}

.not-found__code {
  font-size: 6rem;
  font-weight: 700;
  color: var(--border-color);
  line-height: 1;
}

.not-found__message {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin: 1rem 0 2rem;
}

.not-found__link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent-color);
  font-weight: 500;
}

.not-found__link:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Responsive - Tablet
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .homepage {
    padding: 3rem 1rem;
  }

  .header {
    margin-bottom: 3rem;
  }

  .header__title {
    font-size: 2.25rem;
  }

  .card-grid {
    gap: 1rem;
  }

  .card {
    padding: 1.25rem;
  }

  .card__logo {
    width: 48px;
    height: 48px;
  }

  .dashboard-header__title {
    padding-right: 60px;
  }
}

/* --------------------------------------------------------------------------
   Responsive - Mobile
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .homepage {
    padding: 2rem 1rem;
  }

  .header {
    margin-bottom: 2rem;
  }

  .header__title {
    font-size: 2rem;
  }

  .header__tagline {
    font-size: 1rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .card {
    padding: 1rem 1.25rem;
    gap: 1rem;
  }

  .card__logo {
    width: 44px;
    height: 44px;
    padding: 0.375rem;
  }

  .card__title {
    font-size: 1rem;
  }

  .dashboard-header {
    padding: 0.875rem 1rem;
  }

  .dashboard-header__title {
    font-size: 1rem;
    padding-right: 40px;
  }

  .not-found__code {
    font-size: 4rem;
  }
}
