/* ---- APP LAYOUT ---- */

/* Nav */
.app-nav {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-brand span { color: var(--accent); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Screens */
.screen {
  display: none;
  min-height: calc(100vh - 60px);
}

.screen.active {
  display: block;
}

.screen-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 60px 24px;
}

.screen-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  text-align: center;
  gap: 24px;
}

.screen-header {
  margin-bottom: 48px;
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #0a0a0f;
}

.btn-primary:hover {
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--fg);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: rgba(255, 107, 61, 0.3);
  color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--fg);
  border-color: rgba(255,255,255,0.15);
}

.btn-approve {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.btn-approve:hover {
  background: rgba(34, 197, 94, 0.25);
}

.btn-reject {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.15);
}

.btn-reject:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-edit {
  background: var(--bg-card);
  color: var(--fg-muted);
  border: 1px solid var(--border);
}

.btn-edit:hover {
  color: var(--fg);
  border-color: rgba(255,255,255,0.15);
}

.btn-lg {
  font-size: 1rem;
  padding: 14px 28px;
  border-radius: 12px;
}

.hidden { display: none !important; }

/* ---- FORMS ---- */
.app-form {
  max-width: 720px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.form-group.full {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

label {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.req { color: var(--accent); }

input[type="text"],
select,
textarea {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

input[type="text"]::placeholder,
textarea::placeholder {
  color: rgba(136, 136, 160, 0.5);
}

input[type="text"]:focus,
select:focus,
textarea:focus {
  border-color: rgba(255, 107, 61, 0.4);
  box-shadow: 0 0 0 3px rgba(255, 107, 61, 0.08);
}

select option {
  background: var(--bg-card);
}

textarea { resize: vertical; }

.form-actions {
  margin-top: 32px;
}

/* ---- DASHBOARD ---- */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 48px;
  gap: 24px;
  flex-wrap: wrap;
}

.dashboard-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
  margin-top: 8px;
}

.stats-bar {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 48px;
  flex-wrap: wrap;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 32px;
}

.stat-pill {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-num {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.stat-num.approved { color: #22c55e; }
.stat-num.pending { color: #f59e0b; }
.stat-num.rejected { color: #ef4444; }

/* ---- CALENDAR GRID ---- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* POST CARD */
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
}

.post-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 107, 61, 0.15);
}

.post-card.approved {
  border-color: rgba(34, 197, 94, 0.25);
}

.post-card.rejected {
  opacity: 0.6;
  border-color: rgba(239, 68, 68, 0.2);
}

.post-card-header {
  padding: 16px 20px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.post-date {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.post-status-badge {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 100px;
}

.badge-pending {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-approved {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.badge-rejected {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.15);
}

.post-card-body {
  padding: 16px 20px 12px;
  flex: 1;
}

.post-idea {
  font-size: 0.8rem;
  color: var(--accent);
  font-style: italic;
  margin-bottom: 12px;
  line-height: 1.4;
  background: var(--accent-glow);
  padding: 6px 10px;
  border-radius: 8px;
}

.post-caption {
  font-size: 0.95rem;
  color: var(--fg);
  line-height: 1.65;
  margin-bottom: 12px;
}

/* Show edited caption if available */
.post-caption-edited {
  border-left: 2px solid var(--accent);
  padding-left: 10px;
}

.post-hashtags {
  font-size: 0.82rem;
  color: rgba(255, 107, 61, 0.7);
  line-height: 1.5;
  word-break: break-all;
}

.post-card-actions {
  padding: 12px 20px 16px;
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.post-card-actions .btn {
  font-size: 0.8rem;
  padding: 6px 14px;
  border-radius: 8px;
}

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--fg-muted);
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: 16px;
}

/* ---- AI SPINNER ---- */
.ai-spinner {
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: 8px;
}

.spinner-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

.ring2 {
  inset: 10px;
  border-top-color: var(--accent-soft);
  animation-duration: 1.4s;
  animation-direction: reverse;
}

.ring3 {
  inset: 20px;
  border-top-color: rgba(255, 107, 61, 0.4);
  animation-duration: 0.8s;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 15, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}

.modal-header {
  padding: 24px 24px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.2s;
}

.modal-close:hover { color: var(--fg); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-body .form-group {
  margin-bottom: 20px;
}

.modal-date {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
}

.modal-idea {
  font-size: 0.9rem;
  color: var(--accent);
  font-style: italic;
  line-height: 1.5;
}

.modal-hashtags {
  font-size: 0.85rem;
  color: rgba(255, 107, 61, 0.7);
  line-height: 1.6;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ---- TOAST ---- */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 12px 24px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
  opacity: 0;
  transition: all 0.3s;
  z-index: 300;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success { color: #22c55e; border-color: rgba(34, 197, 94, 0.3); }
.toast.error { color: #ef4444; border-color: rgba(239, 68, 68, 0.3); }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }

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

  .dashboard-header {
    flex-direction: column;
    gap: 16px;
  }

  .stats-bar {
    padding: 16px 20px;
    gap: 20px;
  }

  .screen-inner {
    padding: 32px 16px;
  }
}
