/* ────────────────────────────────────────────────────────────────────────────
   Trippin' Club Story Generator — Main CSS
   Design: Warm Travel Dashboard · Brand-aligned
──────────────────────────────────────────────────────────────────────────── */

/* ── Variables ────────────────────────────────────────────────────────────── */
:root {
  --blue:      #3B84B7;
  --blue-dark: #2d6e9e;
  --blue-light:#e8f3fb;
  --coral:     #E8876A;
  --coral-dark:#d46e52;
  --coral-light:#fdf0ec;
  --gold:      #C9A065;
  --gold-light:#fdf6ec;
  --white:     #ffffff;
  --gray-50:   #f8fafc;
  --gray-100:  #f1f5f9;
  --gray-200:  #e2e8f0;
  --gray-400:  #94a3b8;
  --gray-600:  #475569;
  --gray-700:  #334155;
  --gray-900:  #0f172a;
  --navy:      #1e3a5f;
  --navy-dark: #162c4a;

  --font-body:    'Nunito', sans-serif;
  --font-heading: 'Poppins', sans-serif;

  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
  --shadow:     0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.15);

  --sidebar-w:  240px;
  --topbar-h:   60px;
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }
html { font-size:16px; scroll-behavior:smooth; }
body { font-family:var(--font-body); color:var(--gray-700); background:var(--gray-50); line-height:1.6; }
img  { max-width:100%; display:block; }
a    { color:inherit; text-decoration:none; }
button { cursor:pointer; font-family:inherit; }
input,textarea,select { font-family:inherit; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
}

.sidebar-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.sidebar-backdrop.show {
  opacity: 1; pointer-events: auto;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo {
  width: 140px;
  margin-bottom: 6px;
  /* make white on dark background */
  filter: brightness(0) invert(1);
}
.sidebar-subtitle {
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  font-family: var(--font-heading);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: rgba(255,255,255,.65);
  font-size: .875rem;
  font-weight: 600;
  transition: all .15s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--coral); color: #fff; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--coral);
  color: #fff;
  font-weight: 800;
  font-size: .875rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-name  { font-size: .8rem; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { font-size: .7rem; color: rgba(255,255,255,.45); }
.logout-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.4);
  transition: all .15s;
}
.logout-btn:hover { color: var(--coral); background: rgba(255,255,255,.05); }
.logout-btn svg { width: 16px; height: 16px; }

/* ── Main content ─────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  padding: 4px;
  color: var(--gray-600);
}
.sidebar-toggle svg { width: 22px; height: 22px; }
.page-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
}
.content-area {
  padding: 28px 28px 40px;
  flex: 1;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: .875rem;
  border: 2px solid transparent;
  transition: all .15s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary  { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-coral    { background: var(--coral); color: #fff; border-color: var(--coral); }
.btn-coral:hover { background: var(--coral-dark); border-color: var(--coral-dark); }
.btn-outline  { background: transparent; color: var(--gray-700); border-color: var(--gray-200); }
.btn-outline:hover { border-color: var(--gray-400); background: var(--gray-50); }
.btn-instagram { background: linear-gradient(135deg,#f58529,#dd2a7b,#8134af,#515bd4); color: #fff; border: none; }
.btn-instagram:hover { opacity: .9; }
.btn-lg  { padding: 13px 24px; font-size: 1rem; }
.btn-sm  { padding: 6px 12px; font-size: .8rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: .875rem; margin-bottom: 16px; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #16a34a; }

/* ── Stats grid ───────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px,1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon--blue  { background: var(--blue-light);  color: var(--blue); }
.stat-icon--coral { background: var(--coral-light); color: var(--coral); }
.stat-icon--gold  { background: var(--gold-light);  color: var(--gold); }
.stat-value { display: block; font-size: 1.75rem; font-weight: 800; font-family: var(--font-heading); color: var(--gray-900); line-height: 1; }
.stat-label { font-size: .8rem; color: var(--gray-400); margin-top: 2px; display: block; }

/* ── Section header ───────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
}

/* ── Stories grid ─────────────────────────────────────────────────────────── */
.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px,1fr));
  gap: 20px;
}
.story-card {
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  transition: transform .15s, box-shadow .15s;
}
.story-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.story-thumb {
  aspect-ratio: 9/16;
  background: var(--gray-100);
  position: relative;
  overflow: hidden;
}
.story-thumb img { width: 100%; height: 100%; object-fit: cover; }
.story-thumb-placeholder {
  height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-400);
}
.story-thumb-placeholder svg { width: 40px; height: 40px; }
.story-status {
  position: absolute;
  top: 8px; left: 8px;
  font-size: .65rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.story-status--draft     { background: rgba(0,0,0,.5);   color: #fff; }
.story-status--generated { background: var(--blue);      color: #fff; }
.story-status--published { background: var(--coral);     color: #fff; }

.story-info  { padding: 12px 14px 6px; }
.story-dest  { font-size: .95rem; font-weight: 800; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.story-meta  { font-size: .75rem; color: var(--gray-400); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.story-time  { font-size: .7rem; color: var(--gray-400); }
.story-actions {
  padding: 8px 14px 12px;
  display: flex;
  gap: 6px;
}

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}
.empty-icon { width: 56px; height: 56px; margin: 0 auto 16px; }
.empty-state h3 { color: var(--gray-700); font-size: 1.1rem; margin-bottom: 6px; }
.empty-state p  { font-size: .9rem; margin-bottom: 20px; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: .82rem;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 5px;
}
.form-group label .required { color: var(--coral); margin-left: 2px; }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="decimal"],
textarea,
select {
  width: 100%;
  padding: 9px 12px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .875rem;
  color: var(--gray-900);
  background: #fff;
  transition: border-color .15s;
  outline: none;
}
input:focus,textarea:focus,select:focus { border-color: var(--blue); }
textarea { resize: vertical; min-height: 80px; }

.input-with-icon { position: relative; }
.input-with-icon input { padding-right: 44px; }
.toggle-password {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  color: var(--gray-400);
  padding: 4px;
}
.toggle-password svg { width: 18px; height: 18px; }

/* ── Login ────────────────────────────────────────────────────────────────── */
.login-body {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-container { width: 100%; max-width: 400px; }
.login-card {
  background: #fff;
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-logo { width: 160px; margin: 0 auto 8px; }
.login-subtitle {
  font-family: var(--font-heading);
  font-size: .75rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--gray-400);
}
.login-form .btn-primary { margin-top: 8px; }
.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: .78rem;
  color: rgba(255,255,255,.5);
}

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.modal-box { position: relative; background: #fff; border-radius: var(--radius-xl); padding: 32px; width: 100%; max-width: 440px; box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto; }
.modal-box h3 { font-family: var(--font-heading); font-size: 1.2rem; margin-bottom: 10px; }
.modal-box p  { font-size: .9rem; color: var(--gray-600); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.ig-connect-steps { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.ig-step { display: flex; align-items: flex-start; gap: 10px; font-size: .875rem; }
.ig-step span { width: 22px; height: 22px; border-radius: 50%; background: var(--blue); color: #fff; font-size: .75rem; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--gray-900);
  color: #fff;
  padding: 12px 24px;
  border-radius: 40px;
  font-size: .875rem;
  font-weight: 600;
  opacity: 0;
  transition: all .25s;
  pointer-events: none;
  z-index: 300;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-success { background: #16a34a; }
.toast.toast-error   { background: #dc2626; }

/* ── Admin table ──────────────────────────────────────────────────────────── */
.table-responsive { width: 100%; overflow-x: auto; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); border: 1px solid var(--gray-100); background: #fff; }
.data-table { width: 100%; border-collapse: collapse; min-width: 600px; }
.data-table th { background: var(--gray-50); padding: 12px 16px; font-size: .78rem; font-weight: 700; text-align: left; color: var(--gray-600); text-transform: uppercase; letter-spacing: .05em; border-bottom: 2px solid var(--gray-200); }
.data-table td { padding: 12px 16px; font-size: .875rem; border-bottom: 1px solid var(--gray-100); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-50); }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: .72rem; font-weight: 700; }
.badge-blue  { background: var(--blue-light);  color: var(--blue); }
.badge-coral { background: var(--coral-light); color: var(--coral-dark); }
.badge-gold  { background: var(--gold-light);  color: #8a6a2e; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
.responsive-form { display: flex; gap: 12px; max-width: 400px; align-items: flex-end; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .content-area { padding: 16px; overflow-x: hidden; }
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 24px; }
  .responsive-form { flex-direction: column; align-items: stretch !important; }
  .responsive-form .btn { margin-top: 8px; width: 100%; justify-content: center; }
  .form-grid-2 { grid-template-columns: 1fr; }
}
