/* ==========================================================================
   WOPR Dashboard — Dark Theme Stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties (Theming)
   -------------------------------------------------------------------------- */
:root {
  /* Backgrounds */
  --bg-primary: #0f1419;
  --bg-secondary: #1a2332;
  --bg-card: #1e2a3a;
  --bg-card-hover: #243447;

  /* Text */
  --text-primary: #e8eaed;
  --text-secondary: #9aa0a6;

  /* Accent */
  --accent: #3b82f6;
  --accent-hover: #2563eb;

  /* Semantic */
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Borders */
  --border: #2d3748;

  /* Misc */
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
  --transition: 0.2s ease;
}

/* --------------------------------------------------------------------------
   2. Reset / Base Styles
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

ul, ol {
  list-style: none;
}

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p {
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

small {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

code, pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9rem;
}

pre {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   4. Scrollbar Styling (Dark Theme)
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg-primary);
}

/* --------------------------------------------------------------------------
   5. Layout — Container
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --------------------------------------------------------------------------
   6. Header & Navigation
   -------------------------------------------------------------------------- */
.header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.header__logo img {
  width: 32px;
  height: 32px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav__link {
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.nav__link:hover,
.nav__link--active {
  background: var(--bg-card);
  color: var(--text-primary);
}

.nav__link--active {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   7. Welcome Header
   -------------------------------------------------------------------------- */
.welcome {
  padding: 2rem 0 1rem;
}

.welcome__title {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
}

.welcome__subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 400;
}

/* --------------------------------------------------------------------------
   8. Main Content
   -------------------------------------------------------------------------- */
main {
  flex: 1;
  padding: 1.5rem 0 3rem;
}

/* --------------------------------------------------------------------------
   9. Category Headers
   -------------------------------------------------------------------------- */
.category-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 2rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.category-header:first-child {
  margin-top: 0;
}

.category-header__icon {
  font-size: 1.25rem;
  width: 2rem;
  text-align: center;
}

.category-header__title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.category-header__count {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  padding: 0.15rem 0.6rem;
  border-radius: 10px;
}

/* --------------------------------------------------------------------------
   10. App Grid — Responsive CSS Grid
   -------------------------------------------------------------------------- */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* --------------------------------------------------------------------------
   11. App Tile (Card)
   -------------------------------------------------------------------------- */
.app-tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition),
    box-shadow var(--transition), transform var(--transition);
  position: relative;
}

.app-tile:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.app-tile__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  background: var(--bg-secondary);
  color: var(--accent);
}

.app-tile__icon img {
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
  object-fit: cover;
}

.app-tile__body {
  flex: 1;
  min-width: 0;
}

.app-tile__name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-tile__description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   12. Status Indicators
   -------------------------------------------------------------------------- */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  position: absolute;
  top: 1rem;
  right: 1rem;
}

/* Green — online / healthy */
.status-dot--green {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: pulse-green 2s ease-in-out infinite;
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 4px var(--success); }
  50%      { box-shadow: 0 0 12px var(--success); }
}

/* Red — offline / error */
.status-dot--red {
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
}

/* Yellow — warning / degraded */
.status-dot--yellow {
  background: var(--warning);
  box-shadow: 0 0 6px var(--warning);
}

/* --------------------------------------------------------------------------
   13. Progress Bar (Animated)
   -------------------------------------------------------------------------- */
.progress {
  width: 100%;
  height: 22px;
  background: var(--bg-primary);
  border-radius: 11px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
}

.progress__fill {
  height: 100%;
  border-radius: 11px;
  background: linear-gradient(90deg, var(--accent), var(--success));
  transition: width 0.6s ease;
  position: relative;
}

.progress__fill--animated {
  background-size: 30px 30px;
  background-image: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.1) 75%,
    transparent 75%,
    transparent
  );
  animation: progress-stripes 1s linear infinite;
}

@keyframes progress-stripes {
  0%   { background-position: 30px 0; }
  100% { background-position: 0 0; }
}

.progress__text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  z-index: 1;
}

/* --------------------------------------------------------------------------
   14. Installer Card
   -------------------------------------------------------------------------- */
.installer-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 700px;
  margin: 2rem auto;
  padding: 2rem;
  text-align: center;
}

.installer-card__title {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.installer-card__subtitle {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.installer-card__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   15. Slideshow (Fade Transitions)
   -------------------------------------------------------------------------- */
.slideshow {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
}

.slideshow__slide {
  display: none;
  width: 100%;
  padding: 2.5rem 2rem;
  animation: slide-fade-in 0.5s ease forwards;
  text-align: center;
}

.slideshow__slide--active {
  display: block;
}

@keyframes slide-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.slideshow__dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 0;
}

.slideshow__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  border: none;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

.slideshow__dot:hover {
  background: var(--text-secondary);
}

.slideshow__dot--active {
  background: var(--accent);
  transform: scale(1.2);
}

/* --------------------------------------------------------------------------
   16. Domain Setup Form
   -------------------------------------------------------------------------- */
.domain-form {
  max-width: 600px;
  margin: 0 auto;
}

.domain-form__group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.domain-form__input {
  flex: 1;
  padding: 0.7rem 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color var(--transition);
  outline: none;
}

.domain-form__input::placeholder {
  color: var(--text-secondary);
}

.domain-form__input:focus {
  border-color: var(--accent);
}

.domain-form__btn {
  padding: 0.7rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  transition: background var(--transition);
}

.domain-form__btn:hover {
  background: var(--accent-hover);
}

/* DNS instructions panel */
.dns-instructions {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1rem;
}

.dns-instructions__title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.dns-instructions__row {
  display: flex;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.dns-instructions__row:last-child {
  border-bottom: none;
}

.dns-instructions__label {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 80px;
}

.dns-instructions__value {
  color: var(--text-secondary);
  font-family: monospace;
  word-break: break-all;
}

/* --------------------------------------------------------------------------
   17. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition),
    color var(--transition);
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent-hover);
}

.btn--secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text-primary);
}

.btn--secondary:hover {
  background: var(--bg-card);
  border-color: var(--text-secondary);
}

.btn--danger {
  background: var(--danger);
  color: #fff;
}

.btn--danger:hover {
  background: #dc2626;
}

.btn--sm {
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
}

/* --------------------------------------------------------------------------
   18. Account / Sidebar Section
   -------------------------------------------------------------------------- */
.sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  width: 260px;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
}

.sidebar__section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  padding: 0.75rem 0.5rem 0.35rem;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: background var(--transition), color var(--transition);
}

.sidebar__link:hover,
.sidebar__link--active {
  background: var(--bg-card);
  color: var(--text-primary);
}

.account-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  background: var(--bg-card);
  margin-bottom: 0.5rem;
}

.account-badge__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  flex-shrink: 0;
}

.account-badge__name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.account-badge__email {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   19. Footer
   -------------------------------------------------------------------------- */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   20. Search Box
   -------------------------------------------------------------------------- */
.search-box {
  position: relative;
  max-width: 400px;
  margin-bottom: 1.5rem;
}

.search-box__input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition);
}

.search-box__input::placeholder {
  color: var(--text-secondary);
}

.search-box__input:focus {
  border-color: var(--accent);
}

.search-box__icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
  font-size: 0.95rem;
}

/* --------------------------------------------------------------------------
   21. Utility Classes
   -------------------------------------------------------------------------- */
.text-center  { text-align: center; }
.text-muted   { color: var(--text-secondary); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.hidden { display: none !important; }

/* --------------------------------------------------------------------------
   22. Responsive Breakpoints
   -------------------------------------------------------------------------- */

/* Tablet (768px and below) */
@media (max-width: 768px) {
  .header .container {
    flex-wrap: wrap;
  }

  .nav {
    width: 100%;
    justify-content: center;
  }

  .app-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.75rem;
  }

  .sidebar {
    display: none;
  }

  .installer-card {
    margin: 1rem;
    padding: 1.5rem;
  }

  .welcome__title {
    font-size: 1.4rem;
  }

  .domain-form__group {
    flex-direction: column;
  }

  .dns-instructions__row {
    flex-direction: column;
    gap: 0.25rem;
  }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
  html {
    font-size: 15px;
  }

  .container {
    padding: 0 1rem;
  }

  .app-grid {
    grid-template-columns: 1fr;
  }

  .app-tile {
    padding: 1rem;
  }

  .app-tile__icon {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }

  .nav__link {
    padding: 0.4rem 0.6rem;
    font-size: 0.82rem;
  }

  .slideshow__slide {
    padding: 1.5rem 1rem;
  }

  .installer-card__actions {
    flex-direction: column;
  }
}

/* Desktop-wide (1400px+) */
@media (min-width: 1400px) {
  .container {
    max-width: 1400px;
  }

  .app-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}
