/* ============================================================
   PostHub - Stylesheet
   Font: Inter | Colors: #003064 / #e6e8e6 / #ff3131
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:       #003064;
  --blue-light: #004080;
  --blue-dark:  #00204a;
  --white:      #e6e8e6;
  --red:        #ff3131;
  --red-dark:   #cc1f1f;
  --black:      #111111;
  --gray:       #444b57;
  --gray-light: #9aa0ab;
  --gray-bg:    #f4f5f7;
  --sidebar-w:  260px;
  --radius:     12px;
  --radius-sm:  8px;
  --shadow:     0 2px 16px rgba(0,48,100,.10);
  --shadow-md:  0 4px 24px rgba(0,48,100,.14);
  --transition: .2s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--gray-bg);
  color: var(--black);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 60%, #005099 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  top: -200px; right: -150px;
  pointer-events: none;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: rgba(255,49,49,.07);
  bottom: -150px; left: -100px;
  pointer-events: none;
}

.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,.25);
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo .logo-icon {
  width: 56px; height: 56px;
  background: var(--blue);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.login-logo .logo-icon svg { color: #fff; }
.login-logo h1 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--blue);
  letter-spacing: -0.5px;
}
.login-logo p { color: var(--gray-light); font-size: .88rem; margin-top: 4px; }

.login-tabs {
  display: flex;
  background: var(--gray-bg);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 28px;
  gap: 4px;
}
.login-tab {
  flex: 1;
  padding: 9px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: .85rem;
  color: var(--gray-light);
  transition: var(--transition);
}
.login-tab.active {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 1px 6px rgba(0,48,100,.12);
}

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--gray);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #dde1e8;
  border-radius: var(--radius-sm);
  background: var(--gray-bg);
  color: var(--black);
  transition: var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0,48,100,.08);
}
.form-control::placeholder { color: #bcc2cc; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: .2px;
}
.btn-primary {
  background: var(--blue);
  color: #fff;
  width: 100%;
}
.btn-primary:hover { background: var(--blue-light); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: var(--red-dark); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--blue);
  color: var(--blue);
}
.btn-outline:hover { background: var(--blue); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: .82rem; border-radius: 6px; }
.btn-success { background: #1a9e4a; color: #fff; }
.btn-success:hover { background: #158040; }
.btn-ghost { background: transparent; color: var(--gray); }
.btn-ghost:hover { background: var(--gray-bg); color: var(--blue); }

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .87rem;
  font-weight: 500;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-error  { background: #fff0f0; border: 1px solid #ffc8c8; color: #cc1f1f; }
.alert-success{ background: #f0fff5; border: 1px solid #b2f0c8; color: #158040; }
.alert-info   { background: #f0f4ff; border: 1px solid #c0d0f0; color: var(--blue); }

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--blue);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.10);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-logo .logo-mark {
  width: 40px; height: 40px;
  background: var(--red);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo span {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
}

.sidebar-user {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-user .user-name {
  font-size: .88rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user .user-biz {
  font-size: .78rem;
  color: rgba(255,255,255,.55);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.35);
  padding: 10px 12px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.75);
  font-weight: 500;
  font-size: .9rem;
  transition: var(--transition);
  cursor: pointer;
}
.nav-item svg { flex-shrink: 0; opacity: .8; }
.nav-item:hover { background: rgba(255,255,255,.10); color: #fff; }
.nav-item.active { background: var(--red); color: #fff; }
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- Topbar ---- */
.topbar {
  background: #fff;
  border-bottom: 1px solid #e8eaef;
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 8px rgba(0,48,100,.06);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-title { font-size: 1.1rem; font-weight: 700; color: var(--blue); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  color: var(--blue);
}
.hamburger:hover { background: var(--gray-bg); }

/* ---- Page Content ---- */
.page-content { padding: 32px; flex: 1; }

/* ---- Cards / Stats ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 18px;
  transition: var(--transition);
  border-left: 4px solid transparent;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card.blue  { border-left-color: var(--blue); }
.stat-card.red   { border-left-color: var(--red); }
.stat-card.green { border-left-color: #1a9e4a; }
.stat-card.gray  { border-left-color: var(--gray-light); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon.blue  { background: rgba(0,48,100,.10); color: var(--blue); }
.stat-icon.red   { background: rgba(255,49,49,.10); color: var(--red); }
.stat-icon.green { background: rgba(26,158,74,.10); color: #1a9e4a; }
.stat-icon.gray  { background: var(--gray-bg); color: var(--gray-light); }

.stat-info .stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--blue);
  line-height: 1;
}
.stat-info .stat-label {
  font-size: .8rem;
  color: var(--gray-light);
  margin-top: 4px;
  font-weight: 500;
}

/* ---- Section Headers ---- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--blue);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: '';
  width: 4px; height: 20px;
  background: var(--red);
  border-radius: 2px;
  display: inline-block;
}

/* ---- Posts Table / Cards ---- */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid #eef0f4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-body { padding: 24px; }

.posts-table { width: 100%; border-collapse: collapse; }
.posts-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-light);
  background: var(--gray-bg);
  border-bottom: 1px solid #eef0f4;
}
.posts-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f4f5f7;
  vertical-align: middle;
  font-size: .88rem;
}
.posts-table tr:last-child td { border-bottom: none; }
.posts-table tr:hover td { background: #fafbfd; }
.posts-table tr.done td { opacity: .6; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-blue   { background: rgba(0,48,100,.10); color: var(--blue); }
.badge-red    { background: rgba(255,49,49,.12); color: var(--red); }
.badge-green  { background: rgba(26,158,74,.12); color: #1a9e4a; }
.badge-gray   { background: var(--gray-bg); color: var(--gray); }
.badge-orange { background: rgba(255,145,0,.12); color: #c97200; }

/* ---- Toggle Done ---- */
.toggle-done {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid #dde1e8;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  color: transparent;
}
.toggle-done:hover { border-color: #1a9e4a; color: #1a9e4a; }
.toggle-done.done {
  background: #1a9e4a;
  border-color: #1a9e4a;
  color: #fff;
}

/* ---- Quick Links ---- */
.quick-links { display: flex; gap: 16px; flex-wrap: wrap; }
.quick-link-card {
  flex: 1;
  min-width: 160px;
  background: #fff;
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
  border: 2px solid transparent;
}
.quick-link-card:hover {
  border-color: var(--blue);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.quick-link-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
}
.quick-link-card .link-name {
  font-weight: 700;
  font-size: .95rem;
  color: var(--blue);
}
.quick-link-card .link-desc {
  font-size: .78rem;
  color: var(--gray-light);
}

/* ---- Generate Plan Form ---- */
.generate-card {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-light) 100%);
  border-radius: var(--radius);
  padding: 32px;
  color: #fff;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}
.generate-card::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
  right: -80px; top: -120px;
  pointer-events: none;
}
.generate-card h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 8px; }
.generate-card p  { font-size: .88rem; opacity: .8; margin-bottom: 20px; }
.generate-card .form-control {
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.25);
  color: #fff;
}
.generate-card .form-control::placeholder { color: rgba(255,255,255,.5); }
.generate-card .form-control:focus {
  background: rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.5);
  box-shadow: none;
}
.generate-card label { color: rgba(255,255,255,.85); }
.generate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.btn-white {
  background: #fff;
  color: var(--blue);
  font-weight: 700;
}
.btn-white:hover { background: var(--white); transform: translateY(-1px); }

/* ---- Progress Bar ---- */
.progress-wrap { margin-top: 8px; }
.progress-bar-bg {
  background: #eef0f4;
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, var(--blue), var(--red));
  transition: width .5s ease;
}
.progress-label {
  font-size: .78rem;
  color: var(--gray-light);
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 24px 64px rgba(0,0,0,.2);
  transform: translateY(20px);
  transition: transform .25s;
  overflow: hidden;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  padding: 22px 28px;
  border-bottom: 1px solid #eef0f4;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; color: var(--blue); }
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-light);
  padding: 6px;
  border-radius: 6px;
  font-size: 1.3rem;
  line-height: 1;
  transition: var(--transition);
}
.modal-close:hover { background: var(--gray-bg); color: var(--black); }
.modal-body { padding: 28px; }
.modal-footer {
  padding: 16px 28px;
  border-top: 1px solid #eef0f4;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---- Sidebar overlay for mobile ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}

/* ============================================================
   PROFILE / SETTINGS PAGE
   ============================================================ */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
  align-items: start;
}
.profile-avatar-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 32px 24px;
  box-shadow: var(--shadow);
  text-align: center;
}
.avatar-circle {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.profile-name { font-size: 1.1rem; font-weight: 700; color: var(--blue); }
.profile-email { font-size: .82rem; color: var(--gray-light); margin-top: 2px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.2); }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }
  .hamburger { display: flex; }
  .page-content { padding: 20px 16px; }
  .topbar { padding: 0 16px; }
  .generate-grid { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 32px 24px; }
  .posts-table th:nth-child(4),
  .posts-table td:nth-child(4),
  .posts-table th:nth-child(5),
  .posts-table td:nth-child(5) { display: none; }
  .quick-links { flex-direction: column; }
}

/* ---- Loading spinner ---- */
.spinner {
  width: 22px; height: 22px;
  border: 3px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}
.empty-state svg { color: #dde1e8; margin: 0 auto 16px; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--gray); margin-bottom: 6px; }
.empty-state p  { font-size: .85rem; color: var(--gray-light); }

/* ---- Tooltip ---- */
[data-tip] { position: relative; cursor: default; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--black);
  color: #fff;
  font-size: .75rem;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}