/* AI SEO Studio — base styles */
        /* Force remove padding on homepage */
        .app-main { padding: 0 !important; }

:root {
  --color-bg: #f6f8fb;
  --color-surface: #ffffff;
  --color-border: #e3e8ef;
  --color-text: #0f172a;
  --color-muted: #5b6478;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-danger: #dc2626;
  --color-success: #059669;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow-md: 0 4px 12px rgba(15,23,42,.08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.app-body {
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  width: 100%;
  max-width: 1400px; /* Wider backend */
  margin: 0 auto;
  padding: 0 20px;
}




/* Header */
.app-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky; top: 0; z-index: 10;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; /* Reduced from 64px to 56px */
}

/* Brand Logo High-Res Fix */
.brand-logo {
  height: 32px; /* Reduced from 36px to fit the 56px header */
  width: auto;
  max-width: 100%; /* Prevents stretching */
  display: block;
  object-fit: contain; /* Ensures it doesn't distort */
}

@media (max-width: 520px) {
  .brand-logo {
    height: 26px; /* Slightly smaller on mobile */
  }
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--color-text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--color-primary); color: #fff; font-size: 13px; font-weight: 800;
}
.brand-name { font-size: 16px; }

.main-nav { display: flex; align-items: center; gap: 18px; }
.main-nav a { color: var(--color-text); font-weight: 500; font-size: 14px; }
.main-nav a:hover { color: var(--color-primary); text-decoration: none; }

/* Main */
.app-main { min-height: calc(100vh - 128px); padding: 0; }

/* Footer */
.app-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: 20px 0;
  color: var(--color-muted); font-size: 13px;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 600; font-size: 14px;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); text-decoration: none; }
.btn-outline { background: transparent; color: var(--color-text); border-color: var(--color-border); }
.btn-outline:hover { border-color: var(--color-text); text-decoration: none; }
.btn-danger  { background: var(--color-danger); color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* Forms */
.form-wrap {
  max-width: 420px;
  margin: 40px auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-md);
}
.form-wrap h1 { margin: 0 0 6px; font-size: 24px; }
.form-wrap .muted { color: var(--color-muted); margin: 0 0 24px; font-size: 14px; }

.form-field { margin-bottom: 18px; }
.form-field label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--color-text); margin-bottom: 6px;
}
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="password"] {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 14px; font-family: inherit;
  background: #fff; color: var(--color-text);
}
.form-field input:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-hint { font-size: 12px; color: var(--color-muted); margin-top: 4px; }

.alert {
  padding: 10px 14px; border-radius: 8px;
  font-size: 14px; margin-bottom: 18px;
}
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

.form-actions { margin-top: 8px; }
.form-actions .btn { width: 100%; }
.form-footer { text-align: center; margin-top: 18px; font-size: 14px; color: var(--color-muted); }


/* Dashboard shell — flex layout, nav is fixed-width */
.dash-layout { display: flex; gap: 0; min-height: 100vh; }

.dash-content { min-width: 0; }
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.card h2 { margin: 0 0 4px; font-size: 18px; }
.card p.muted { color: var(--color-muted); margin: 0; font-size: 14px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

/* Hero (landing) */
.hero { text-align: center; padding: 60px 0 40px; }
.hero h1 { font-size: 42px; margin: 0 0 12px; letter-spacing: -0.02em; }
.hero p { font-size: 18px; color: var(--color-muted); max-width: 640px; margin: 0 auto 28px; }
.hero .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Responsive */
@media (max-width: 820px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 32px; }
  .hero p  { font-size: 16px; }
}
@media (max-width: 520px) {
  .form-wrap { padding: 22px; margin: 20px auto; }
  .header-inner { gap: 12px; }
  .main-nav { gap: 12px; }
}
  /* Ensure the fixed drawer isn't clipped by the parent */
  .dash-layout { overflow: visible !important; height: auto !important; }
  .dash-content { min-height: 100vh; }
/* ---------- Mobile hamburger & overlay ---------- */
.mobile-nav-toggle { display: none; position: fixed; top: 14px; left: 14px; z-index: 90;
  width: 42px; height: 42px; border-radius: 10px; border: 1px solid #e2e8f0;
  background: #fff; color: #0f172a; cursor: pointer; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(15,23,42,.08); }
.mobile-nav-toggle:hover { background: #f8fafc; }

.mobile-nav-overlay { display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,.45); z-index: 95; }

/* ---------- Mobile breakpoint ---------- */
@media (max-width: 820px) {

  /* Show hamburger */
  .mobile-nav-toggle { display: inline-flex; }

  /* Turn the sidebar into an off-canvas drawer */
  .side-nav {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 270px;
    min-width: 270px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,.15);
  }

  /* Slide in when .mobile-open is added */
  .side-nav.mobile-open {
    transform: translateX(0);
  }

  /* Overlay shows when drawer is open */
  .mobile-nav-overlay.show {
    display: block;
  }

  /* Hide the "Collapse" button on mobile — irrelevant there */
  .collapse-btn { display: none !important; }

  /* Re-show the texts that the collapse logic hides */
  .side-nav.collapsed .nav-text,
  .side-nav.collapsed .site-info,
  .side-nav.collapsed .user-info,
  .side-nav.collapsed .help-text,
  .side-nav.collapsed .logout-btn span { display: initial !important; }

  /* If it was collapsed on desktop, force it expanded on mobile */
  .side-nav.collapsed { width: 270px; min-width: 270px; padding: 20px 16px; }

  /* Content takes full width, with space for the fixed hamburger */
  .dash-content { padding: 68px 16px 30px 16px !important; }

  /* Hide the hamburger when the drawer is open (overlay covers everything anyway) */
  .side-nav.mobile-open ~ .mobile-nav-toggle { display: none; }
}


/* ---- Phase 3 additions ---- */

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 12px; flex-wrap: wrap;
}
.page-header h1 { margin: 0; font-size: 22px; }
.page-actions { display: flex; gap: 10px; }

.site-list { display: grid; gap: 14px; }
.site-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.site-meta { min-width: 0; }
.site-meta h3 { margin: 0 0 4px; font-size: 16px; }
.site-meta .site-url { color: var(--color-muted); font-size: 13px; word-break: break-all; }

.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px;
  margin-left: 8px;
}
.status-active       { background: #ecfdf5; color: #065f46; }
.status-error        { background: #fef2f2; color: #991b1b; }
.status-disconnected { background: #f3f4f6; color: #4b5563; }

.site-actions { display: flex; gap: 8px; flex-shrink: 0; }
.site-actions .btn { padding: 6px 12px; font-size: 13px; }

/* Wizard */
.wizard-steps {
  display: flex; gap: 8px; margin-bottom: 24px;
  list-style: none; padding: 0;
}
.wizard-steps li {
  flex: 1;
  padding: 10px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 13px; color: var(--color-muted);
  display: flex; align-items: center; gap: 8px;
}
.wizard-steps li.active {
  border-color: var(--color-primary);
  color: var(--color-primary);
  font-weight: 600;
}
.wizard-steps li .n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--color-border); color: var(--color-text);
  font-size: 12px; font-weight: 700;
}
.wizard-steps li.active .n { background: var(--color-primary); color: #fff; }

.callout {
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: var(--radius);
  padding: 14px 16px; font-size: 14px; color: #1e3a8a;
}
.callout ol { margin: 8px 0 0; padding-left: 20px; }
.callout code {
  background: #fff; padding: 1px 6px; border-radius: 4px;
  font-size: 12.5px; border: 1px solid #bfdbfe;
}

.empty-state {
  text-align: center; padding: 48px 24px;
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
}
.empty-state h2 { margin: 0 0 6px; }
.empty-state p { color: var(--color-muted); margin: 0 0 20px; }

.check-result {
  padding: 12px 14px; border-radius: 8px; margin-bottom: 16px;
  font-size: 14px;
}
.check-result.ok    { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.check-result.fail  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }





/* Phase 4 additions */
.form-field select,
.form-field textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 14px; font-family: inherit;
  background: #fff; color: var(--color-text);
}
.form-field select:focus,
.form-field textarea:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}



/* Phase 4C admin additions */
.admin-table { width:100%; border-collapse:collapse; }
.admin-table th, .admin-table td { padding:10px 8px; text-align:left; border-bottom:1px solid var(--color-border); }
.admin-table tr:hover { background:#f8fafc; }
.status.status-active       { background:#ecfdf5; color:#065f46; }
.status.status-error        { background:#fef2f2; color:#991b1b; }
.status.status-disconnected { background:#f3f4f6; color:#4b5563; }


/* Phase 4C-3 additions */

/* Dashboard stat cards */
.stat { padding:22px; }
.stat-label {
  font-size:12px; font-weight:600; color:var(--color-muted);
  text-transform:uppercase; letter-spacing:.05em;
}
.stat-value {
  font-size:32px; font-weight:700; margin:8px 0 4px;
  line-height:1.1;
}
.stat-sub { font-size:13px; color:var(--color-muted); }

/* Articles table */
.articles-table {
  width:100%;
  border-collapse:collapse;
  font-size:14px;
}
.articles-table thead th {
  text-align:left;
  padding:12px 16px;
  background:#f8fafc;
  border-bottom:1px solid var(--color-border);
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--color-muted);
  font-weight:600;
}
.articles-table tbody td {
  padding:14px 16px;
  border-bottom:1px solid var(--color-border);
  vertical-align:middle;
}
.articles-table tbody tr:hover { background:#f8fafc; }
.articles-table tbody tr:last-child td { border-bottom:none; }

.article-thumb {
  width:64px;
  height:64px;
  object-fit:cover;
  border-radius:8px;
  background:#eef2f7;
  display:block;
}

@media (max-width: 820px) {
  .articles-table thead { display:none; }
  .articles-table, .articles-table tbody, .articles-table tr, .articles-table td {
    display:block;
    width:100%;
  }
  .articles-table tr { padding:14px 0; border-bottom:1px solid var(--color-border); }
  .articles-table td { padding:4px 14px; border:none; }
  .articles-table td:first-child { padding-top:0; }
}



/* Phase 4C-4A additions */
.time-row select {
  font-size: 14px;
  font-family: inherit;
  color: var(--color-text);
  background: #fff;
}
.time-row select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}



/* Phase 5C additions */
.stat-value { letter-spacing: -0.01em; }
.articles-table thead th a:hover { text-decoration: underline; }
.articles-table td a { color: var(--color-primary); }




/* Phase 8 legal pages */
.legal-page { max-width: 820px; margin: 0 auto; padding: 20px 0; }
.legal-page h1 { font-size: 32px; margin: 0 0 6px; }
.legal-page h2 { font-size: 20px; margin: 28px 0 8px; }
.legal-page h3 { font-size: 16px; margin: 20px 0 6px; }
.legal-page p, .legal-page li { font-size: 15px; line-height: 1.7; }
.legal-page ul { padding-left: 22px; }
.legal-page .muted { color: var(--color-muted); font-size: 13px; margin-bottom: 24px; }
.app-footer a { color: var(--color-text); }
.app-footer a:hover { color: var(--color-primary); text-decoration: none; }



/* Brand logo in header */
.brand-with-logo { display: flex; align-items: center; }
.brand-logo {
  height: 36px;
  width: auto;
  display: block;
}
@media (max-width: 520px) {
  .brand-logo { height: 30px; }
}






/* --- Premium Pricing UI --- */
.pricing-header { text-align: center; margin-bottom: 24px; }
.pricing-header h2 { font-size: 22px; margin-bottom: 6px; }
.pricing-header p { color: var(--color-muted); font-size: 14px; margin: 0; }

.billing-toggle {
  display: inline-flex; background: #f1f5f9; padding: 4px; border-radius: 8px;
  margin: 20px auto; gap: 4px;
}
.billing-toggle button {
  padding: 6px 20px; border-radius: 6px; border: none; background: transparent;
  font-size: 14px; font-weight: 600; color: var(--color-muted); cursor: pointer;
  transition: all 0.2s;
}
.billing-toggle button.active {
  background: #fff; color: var(--color-primary); box-shadow: var(--shadow-sm);
}

.pricing-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
  align-items: stretch; margin-bottom: 40px;
}

.pricing-card {
  background: #fff; border: 1px solid var(--color-border);
  border-radius: 12px; padding: 24px; display: flex; flex-direction: column;
  box-shadow: 0 4px 6px rgba(0,0,0,.02);
  position: relative;
}
.pricing-card.current {
  border-color: #c7d2fe; box-shadow: 0 4px 12px rgba(37,99,235,.08);
}
.pricing-card-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;
}
.pricing-card h3 { font-size: 18px; margin: 0; font-weight: 600; }
.badge-current {
  background: #ecfdf5; color: #065f46; font-size: 11px; font-weight: 700;
  padding: 4px 8px; border-radius: 6px; border: 1px solid #a7f3d0;
}

.price-display { display: flex; align-items: baseline; gap: 6px; margin-bottom: 6px; }
.price-current { font-size: 36px; font-weight: 800; color: var(--color-primary); line-height: 1; }
.price-old {
  font-size: 16px; color: #94a3b8; text-decoration: line-through; font-weight: 600;
}
.price-period { font-size: 14px; color: var(--color-muted); font-weight: 500; }

.pricing-subtext {
  font-size: 14px; color: var(--color-muted); margin-bottom: 20px; min-height: 42px;
}
.pricing-divider {
  height: 1px; background: var(--color-border); margin-bottom: 20px;
}
.pricing-features { margin-bottom: 24px; flex-grow: 1; }
.pricing-features h4 { font-size: 15px; margin: 0 0 6px; font-weight: 600; }
.pricing-features p { font-size: 13.5px; color: var(--color-muted); line-height: 1.5; margin: 0; }

.btn-pill { border-radius: 8px; padding: 10px 16px; font-size: 14px; font-weight: 600; }

.value-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; margin-top: 20px; }
.value-item { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: #334155; }
.value-icon {
  width: 20px; height: 20px; color: var(--color-primary);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}

@media (max-width: 820px) {
  .pricing-grid { grid-template-columns: 1fr; }
  .value-grid { grid-template-columns: 1fr; }
}


/* Fix for dark inputs on light backgrounds */
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="password"],
.form-field input[type="url"],
.form-field select,
.form-field textarea {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,.12) !important;
}


/* Public pages (homepage, legal, login, register, contact) — normal width */
body.is-public .container {
    max-width: 1160px !important;
    margin: 0 auto !important;
    padding: 0 20px !important;
}


/* Password Visibility Toggle */
.password-wrapper {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  margin-bottom: 0;
}

.password-wrapper input {
  width: 100% !important;
  padding-right: 45px !important; 
}

.toggle-password {
  position: absolute !important;
  right: 12px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  color: #94a3b8 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  margin: 0 !important;
  z-index: 10 !important;
}

.toggle-password:hover {
  color: #0f172a !important;
}

.toggle-password svg {
  width: 20px !important;
  height: 20px !important;
  display: block !important;
}









/* ============================================================
   Dashboard & Admin full-width app layout
   Scoped with .is-app — only affects pages where layout.php
   set <body class="app-body is-app">
   ============================================================ */
body.is-app .app-header,
body.is-app .app-footer { display: none !important; }

body.is-app .app-main {
  padding: 0 !important;
  margin: 0 !important;
  min-height: 100vh;
}

body.is-app .container {
  max-width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}

body.is-app .dash-layout {
  display: flex !important;
  height: 100vh;
  overflow: hidden;
  gap: 0 !important;
}

body.is-app .dash-content {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
  background: #f8fafc;
  min-width: 0;
}

body.is-app .side-nav {
  position: sticky !important;
  top: 0 !important;
  height: 100vh;
}















/* ============================================================
   DEFINITIVE MOBILE DASHBOARD LAYOUT
   ============================================================ */
body.is-app .app-header, 
body.is-app .app-footer { display: none !important; }
body.is-app .app-main { padding: 0 !important; margin: 0 !important; min-height: 100vh; }
body.is-app .container { max-width: 100% !important; padding: 0 !important; margin: 0 !important; }

.dash-layout { display: flex; min-height: 100vh; gap: 0; align-items: stretch; }
.dash-content { flex: 1; padding: 30px; background: #f8fafc; min-width: 0; overflow-x: hidden; }

@media (min-width: 821px) {
    .side-nav { position: sticky; top: 0; height: 100vh; }
    .dash-content { max-height: 100vh; overflow-y: auto; }
}

@media (max-width: 820px) {
    .dash-layout { display: block !important; width: 100% !important; overflow-x: hidden; }
    .dash-content { width: 100% !important; padding: 70px 16px 30px 16px !important; margin: 0 !important; }
    
    /* Force the sidebar to hide off-screen */
    .side-nav {
        position: fixed !important;
        top: 0 !important;
        left: -280px !important; /* Hide it */
        width: 270px !important;
        height: 100vh !important;
        z-index: 9999 !important;
        transition: left 0.3s ease !important;
        box-shadow: 4px 0 20px rgba(0,0,0,0.15) !important;
        overflow-y: auto !important;
    }
    
    /* Slide it in when .mobile-open is added */
    .side-nav.mobile-open {
        left: 0 !important;
    }
    
    body.mobile-menu-active {
        overflow: hidden !important;
    }
}