/* ============================================================
   styles.css
   Global stylesheet for app.fakenewsprank.com
   Sections:
     1. Reset & Base
     2. Typography
     3. Layout Utilities
     4. Loading Overlay
     5. Auth Pages (login / signup)
     6. App Shell Header
     7. Page Content
     8. Buttons
     9. Forms
    10. Cards
    11. Alerts / Error Messages
    12. Responsive
============================================================ */

/* ── 1. Reset & Base ─────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  background-color: #f4f5f7;
  color: #1a1a2e;
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: #4361ee;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ── 2. Typography ───────────────────────────────────────── */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.25;
  color: #1a1a2e;
}

h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p {
  color: #4a4a6a;
}

/* ── 3. Layout Utilities ─────────────────────────────────── */
.page-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.page-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── 4. Loading Overlay ──────────────────────────────────── */
#app-loading {
  position: fixed;
  inset: 0;
  background: #f4f5f7;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: #4361ee;
}

.spinner-ring {
  width: 44px;
  height: 44px;
  border: 4px solid #e0e0f0;
  border-top-color: #4361ee;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-spinner p {
  font-size: 0.9rem;
  color: #6b6b8a;
}

/* ── 5. Auth Pages ───────────────────────────────────────── */
.auth-card {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-logo .logo-icon {
  font-size: 2.25rem;
  display: block;
  margin-bottom: 0.4rem;
}

.auth-logo .logo-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #1a1a2e;
}

.auth-logo .logo-sub {
  font-size: 0.82rem;
  color: #8888a8;
  margin-top: 0.2rem;
}

.auth-card h1 {
  font-size: 1.5rem;
  margin-bottom: 0.35rem;
}

.auth-card .auth-subtitle {
  font-size: 0.9rem;
  color: #6b6b8a;
  margin-bottom: 1.75rem;
}

.auth-footer {
  text-align: center;
  font-size: 0.875rem;
  color: #6b6b8a;
  margin-top: 1.25rem;
}

/* ── 6. App Shell Header ─────────────────────────────────── */
.app-header {
  background: #ffffff;
  border-bottom: 1px solid #e8e8f0;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.05);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1rem;
  color: #1a1a2e;
  text-decoration: none;
  white-space: nowrap;
}

.brand-icon {
  font-size: 1.3rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #4a4a6a;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}

.nav-link:hover {
  background: #f0f0fa;
  color: #1a1a2e;
  text-decoration: none;
}

.nav-link.active {
  background: #eef0fd;
  color: #4361ee;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-email {
  font-size: 0.8rem;
  color: #6b6b8a;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 7. Page Content ─────────────────────────────────────── */
#app-content {
  /* hidden until shell reveals it */
}

.page-main {
  padding: 2.5rem 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

.page-title {
  margin-bottom: 0.4rem;
}

.page-subtitle {
  color: #6b6b8a;
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

/* Welcome banner on dashboard */
.welcome-banner {
  background: linear-gradient(135deg, #4361ee 0%, #7b5ea7 100%);
  color: #fff;
  border-radius: 12px;
  padding: 2rem 2rem;
  margin-bottom: 2rem;
}

.welcome-banner h2 {
  color: #fff;
  font-size: 1.4rem;
  margin-bottom: 0.3rem;
}

.welcome-banner p {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.95rem;
}

/* Quick-action cards on dashboard */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

/* ── 8. Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: #4361ee;
  color: #fff;
  width: 100%;
}

.btn-primary:hover {
  background: #3451d1;
  box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.btn-primary:disabled {
  background: #a0b0f0;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: #f0f0fa;
  color: #4361ee;
}

.btn-secondary:hover {
  background: #e0e2f8;
}

.btn-logout {
  background: transparent;
  color: #e63946;
  border: 1px solid #f0b8bc;
  border-radius: 6px;
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-logout:hover {
  background: #fef2f2;
  color: #c1121f;
}

.btn-danger {
  background: #e63946;
  color: #fff;
}

.btn-danger:hover {
  background: #c1121f;
}

/* ── 9. Forms ────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #3a3a5a;
  margin-bottom: 0.4rem;
}

.form-group input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid #dde0f0;
  border-radius: 8px;
  font-size: 0.95rem;
  color: #1a1a2e;
  background: #fafbff;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-group input:focus {
  border-color: #4361ee;
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.12);
  background: #fff;
}

.form-group input::placeholder {
  color: #b0b0c8;
}

/* ── 10. Cards ───────────────────────────────────────────── */
.card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e8e8f0;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  display: block;
}

.card h3 {
  font-size: 1rem;
  margin-bottom: 0.35rem;
}

.card p {
  font-size: 0.875rem;
  color: #6b6b8a;
  margin-bottom: 1rem;
}

/* Account info rows */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 0;
  border-bottom: 1px solid #f0f0f8;
  font-size: 0.9rem;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  font-weight: 600;
  color: #3a3a5a;
}

.info-value {
  color: #6b6b8a;
}

/* Placeholder / coming soon area */
.coming-soon {
  text-align: center;
  padding: 3.5rem 2rem;
  background: #f9f9fd;
  border-radius: 12px;
  border: 2px dashed #dde0f0;
}

.coming-soon .cs-icon {
  font-size: 2.75rem;
  display: block;
  margin-bottom: 1rem;
}

.coming-soon h2 {
  margin-bottom: 0.5rem;
}

.coming-soon p {
  font-size: 0.9rem;
  color: #8888a8;
  max-width: 360px;
  margin: 0 auto;
}

/* ── 11. Alerts / Error Messages ─────────────────────────── */
.alert {
  padding: 0.8rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1.1rem;
  display: none; /* shown via JS */
}

.alert.visible {
  display: block;
}

.alert-error {
  background: #fef2f2;
  color: #c1121f;
  border: 1px solid #fbc4c4;
}

.alert-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* ── 12. Google Sign-In Button ───────────────────────────── */

.auth-signin-label {
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a2e;
  text-align: center;
  margin-bottom: 1.5rem;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.7rem 1.25rem;
  background: #fff;
  color: #3a3a5a;
  border: 1.5px solid #dde0f0;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.btn-google:hover {
  background: #f8f9ff;
  border-color: #b0b8e8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn-google:active {
  background: #f0f2ff;
}

.btn-google:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.google-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ── 13. Header Credits ──────────────────────────────────── */

.header-credits {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.credits-balance {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #3a3a5a;
  background: #f0f0fa;
  border: 1px solid #e0e0f0;
  border-radius: 20px;
  padding: 0.3rem 0.75rem;
  white-space: nowrap;
}

.credits-icon {
  font-size: 0.9rem;
}

.credits-label {
  font-weight: 400;
  color: #8888a8;
}

.btn-buy-credits {
  font-size: 0.78rem;
  font-weight: 700;
  color: #4361ee;
  background: #eef0fd;
  border: 1px solid #c8cef8;
  border-radius: 20px;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.btn-buy-credits:hover {
  background: #dde1fb;
  border-color: #b0b8f0;
  text-decoration: none;
}

/* ── 14. Credits Page ────────────────────────────────────── */

.credits-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, #4361ee 0%, #7b5ea7 100%);
  color: #fff;
  border-radius: 12px;
  padding: 1.5rem 2rem;
  margin-bottom: 2rem;
  max-width: 400px;
}

.credits-banner-icon {
  font-size: 2.25rem;
}

.credits-banner-count {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.credits-banner-label {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 0.2rem;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
  max-width: 800px;
}

.pricing-card {
  background: #fff;
  border: 1.5px solid #e8e8f0;
  border-radius: 12px;
  padding: 1.75rem 1.5rem;
  text-align: center;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.15s, border-color 0.15s;
}

.pricing-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.pricing-card--featured {
  border-color: #4361ee;
  box-shadow: 0 4px 20px rgba(67, 97, 238, 0.15);
}

.pricing-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: #4361ee;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.75rem;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: 0.03em;
}

.pricing-amount {
  font-size: 3rem;
  font-weight: 800;
  color: #1a1a2e;
  line-height: 1;
  margin-bottom: 0.1rem;
}

.pricing-unit {
  font-size: 0.85rem;
  color: #8888a8;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.pricing-price {
  font-size: 1.35rem;
  font-weight: 700;
  color: #4361ee;
  margin-bottom: 0.5rem;
}

.pricing-desc {
  font-size: 0.825rem;
  color: #8888a8;
  margin-bottom: 1.25rem;
}

.pricing-btn {
  width: 100%;
}

.credits-coming-soon {
  font-size: 0.85rem;
  color: #aaaacc;
  font-style: italic;
  margin-top: 0.5rem;
}

/* ── 15. Responsive ──────────────────────────────────────── */
@media (max-width: 640px) {
  .app-header {
    padding: 0 1rem;
    flex-wrap: wrap;
    height: auto;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    gap: 0.5rem;
  }

  .header-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }

  .user-email {
    display: none;
  }

  .page-main {
    padding: 1.5rem 1rem;
  }

  .auth-card {
    padding: 2rem 1.25rem;
  }

  h1 { font-size: 1.5rem; }
}
