/* DevCheap — Apple-grade redesign */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500&display=swap');

:root {
  --font-sans: 'Inter', -apple-system, 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

  --bg: #0a0a0a;
  --bg-elevated: #1d1d1f;
  --bg-surface: #151517;
  --bg-input: #1d1d1f;
  --border: #2a2a2c;
  --border-hover: #424245;

  --text: #f5f5f7;
  --text-secondary: #86868b;
  --text-tertiary: #6e6e73;

  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-glow: rgba(0, 113, 227, 0.12);

  --green: #30d158;
  --green-glow: rgba(48, 209, 88, 0.1);
  --orange: #ff9f0a;
  --red: #ff453a;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
  --shadow-xl: 0 12px 48px rgba(0,0,0,0.6);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --nav-height: 52px;
}

[data-theme="light"] {
  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --bg-surface: #e8e8ed;
  --bg-input: #e8e8ed;
  --border: #d2d2d7;
  --border-hover: #a1a1a6;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --accent: #0071e3;
  --accent-hover: #0066d6;
  --accent-glow: rgba(0, 113, 227, 0.08);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
  --shadow-xl: 0 12px 48px rgba(0,0,0,0.12);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

::-moz-selection { background: var(--accent); color: #fff; }
::selection { background: var(--accent); color: #fff; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.47059;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: 0;
  min-height: 100vh;
}

.container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Navigation ---- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(10,10,10,0.85);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  z-index: 500;
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] .nav {
  background: rgba(245,245,247,0.8);
}

.nav-inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.nav-logo-badge {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text);
}

.nav-logo-tag {
  font-size: 10px;
  font-weight: 600;
  background: var(--bg-surface);
  color: var(--text-tertiary);
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}
.nav-link:hover { color: var(--text); }

.theme-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.theme-btn:hover {
  color: var(--text);
  background: var(--bg-surface);
}

/* ---- Hero ---- */
.hero {
  position: relative;
  padding: 140px 0 80px;
  text-align: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 600px 400px at 50% -100px, rgba(0,113,227,0.08), transparent);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-title {
  font-size: clamp(40px, 8vw, 68px);
  font-weight: 700;
  letter-spacing: -1.5px;
  line-height: 1.08;
  color: var(--text);
  margin-bottom: 20px;
}

.hero-subtitle {
  font-size: 18px;
  font-weight: 400;
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto 36px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 56px;
}

.hero-btn {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 24px;
  border-radius: 980px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}
.hero-btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.hero-btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}
.hero-btn-outline:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hero-stat-num {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}
.hero-stat-label {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-tertiary);
}

/* ---- Sections ---- */
.section {
  padding: 80px 0;
}
.section-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

/* ---- Deals Section ---- */
.deals-section {
  padding-top: 40px;
}
.deals-header {
  margin-bottom: 28px;
}

/** Search row **/
.search-row {
  margin: 20px 0;
}
.search-wrap {
  position: relative;
  max-width: 400px;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}
.search-input {
  width: 100%;
  height: 40px;
  padding: 0 36px 0 42px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus {
  border-color: var(--accent);
}
.search-input::-webkit-search-cancel-button { display: none; }
.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.search-clear:hover { color: var(--text); }

/** Categories **/
.categories {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.cat-btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 980px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.cat-btn:hover {
  color: var(--text);
  border-color: var(--border-hover);
}
.cat-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---- Deals Grid ---- */
.results-info {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

.deals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.deal-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.25s cubic-bezier(0.22,1,0.36,1), box-shadow 0.25s ease, border-color 0.25s ease;
}
.deal-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

.deal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.deal-card-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--text);
}

.deal-card-cat {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 980px;
  background: var(--accent-glow);
  color: var(--accent);
  white-space: nowrap;
}

.deal-card-deal {
  font-size: 15px;
  font-weight: 500;
  color: var(--green);
  margin-bottom: 8px;
}

.deal-card-desc {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 14px;
  flex-grow: 1;
}

.deal-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}

.deal-card-tag {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  background: var(--bg-surface);
  padding: 2px 8px;
  border-radius: 4px;
}

.deal-card-footer {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.deal-card-btn {
  flex: 1;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
}

.deal-card-btn-primary {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
}
.deal-card-btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.deal-card-btn-code {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
}
.deal-card-btn-code:hover {
  border-color: var(--border-hover);
  background: var(--bg-input);
}

/* ---- Empty state ---- */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 0;
  color: var(--text-tertiary);
}
.empty-state svg {
  margin-bottom: 12px;
  opacity: 0.3;
}
.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.empty-state p {
  font-size: 14px;
}

/* ---- Newsletter ---- */
.newsletter-section {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.newsletter-container {
  display: flex;
  align-items: center;
  gap: 60px;
}
.newsletter-content {
  flex: 1;
}
.newsletter-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
  margin-bottom: 8px;
}
.newsletter-desc {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
  max-width: 480px;
}
.newsletter-form {
  max-width: 420px;
}
.newsletter-input-row {
  display: flex;
  gap: 8px;
}
.newsletter-input {
  flex: 1;
  height: 44px;
  padding: 0 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.newsletter-input:focus {
  border-color: var(--accent);
}
.newsletter-submit {
  height: 44px;
  padding: 0 20px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.newsletter-submit:hover {
  background: var(--accent-hover);
}
.newsletter-note {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 8px;
}

/** Mock email card **/
.newsletter-visual {
  flex: 0 0 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mock-card {
  width: 260px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.mock-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
.mock-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.mock-card-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-left: 6px;
}
.mock-card-body {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mock-line {
  height: 8px;
  border-radius: 4px;
  background: var(--bg-surface);
}
.mock-line-accent {
  background: var(--accent);
  opacity: 0.4;
}

/* ---- Footer ---- */
.footer {
  padding: 40px 0;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.footer-text {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 4px;
}
.footer-links {
  display: flex;
  gap: 20px;
}
.footer-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}
.footer-link:hover { color: var(--text); }

/* ---- Popup ---- */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}
.popup-overlay.show {
  opacity: 1;
  visibility: visible;
}

.popup {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  max-width: 400px;
  width: 90%;
  position: relative;
  transform: scale(0.92) translateY(8px);
  transition: transform 0.35s cubic-bezier(0.22,1,0.36,1);
}
.popup-overlay.show .popup {
  transform: scale(1) translateY(0);
}

.popup-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.popup-close:hover {
  color: var(--text);
  background: var(--bg-surface);
}

.popup-body { text-align: center; }
.popup-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 8px;
}
.popup-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}
.popup-sub-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.popup-input {
  height: 44px;
  padding: 0 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.popup-input:focus {
  border-color: var(--accent);
}
.popup-btn {
  height: 44px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.popup-btn:hover { background: var(--accent-hover); }
.popup-note {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ---- Cards entrance animation ---- */
.deal-card {
  opacity: 0;
  transform: translateY(12px);
  animation: cardIn 0.4s cubic-bezier(0.22,1,0.36,1) forwards;
}
@keyframes cardIn {
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Skeleton ---- */
.skeleton {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.skeleton-line {
  height: 14px;
  border-radius: 6px;
  background: var(--bg-surface);
  margin-bottom: 12px;
  animation: pulse 1.5s ease-in-out infinite;
}
.skeleton-line:last-child { width: 60%; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .hero { padding: 110px 0 60px; }
  .hero-stats { gap: 32px; }
  .hero-stat-num { font-size: 26px; }

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

  .newsletter-container {
    flex-direction: column;
    gap: 32px;
  }
  .newsletter-visual { display: none; }

  .categories { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .cat-btn { white-space: nowrap; }
}

@media (max-width: 480px) {
  .hero-title { font-size: 34px; }
  .hero-actions { flex-direction: column; align-items: center; }
  .hero-stat-num { font-size: 22px; }
  .hero-stats { gap: 24px; flex-wrap: wrap; }
  .section-title { font-size: 26px; }
  .newsletter-input-row { flex-direction: column; }
  .popup { padding: 28px; }
}