/* ============================================================
   Social Media Calendar Pro — Base Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Root Tokens ── */
:root {
  --color-bg:          #080a11;
  --color-surface:     #111827;
  --color-surface-2:   #1f2937;
  --color-border:      rgba(148,163,184,0.08);
  --color-text:        #f8fafc;
  --color-text-muted:  #94a3b8;
  --color-accent:      #6366f1;
  --color-accent-light:#818cf8;
  --color-accent-glow: rgba(99,102,241,0.2);
  --color-success:     #10b981;
  --color-warning:     #f59e0b;
  --color-danger:      #ef4444;
  --color-info:        #38bdf8;

  /* Platform Colors */
  --instagram:  linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  --facebook:   #1877f2;
  --linkedin:   #0a66c2;
  --tiktok:     #fe2c55;
  --twitter:    #1da1f2;
  --pinterest:  #e60023;
  --youtube:    #ff0000;

  --radius-sm:  8px;
  --radius:     16px;
  --radius-lg:  24px;
  --radius-xl:  32px;
  --shadow-sm:  0 1px 2px rgba(0,0,0,0.4);
  --shadow:     0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -2px rgba(0,0,0,0.3);
  --shadow-lg:  0 25px 50px -12px rgba(0,0,0,0.7);
  --transition: 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Mode */
.light {
  --color-bg:         #f8fafc;
  --color-surface:    #ffffff;
  --color-surface-2:  #f1f5f9;
  --color-border:     rgba(15,23,42,0.08);
  --color-text:       #0f172a;
  --color-text-muted: #64748b;
}

/* ── Base Reset ── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition), color var(--transition);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-surface-2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-accent); }

/* ── Typography ── */
h1,h2,h3,h4,h5,h6 { font-weight: 600; line-height: 1.3; letter-spacing: -0.02em; }

/* ── Glass Components ── */
.glass-card {
  background: rgba(17, 24, 39, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}
.light .glass-card {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

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

#sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  transition: width var(--transition), min-width var(--transition);
  z-index: 40;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  overflow: hidden;
}

#sidebar.collapsed { width: 72px; min-width: 72px; }

#sidebar .sidebar-label,
#sidebar .sidebar-section-title {
  transition: opacity var(--transition), max-width var(--transition);
  white-space: nowrap;
  overflow: hidden;
}

#sidebar.collapsed .sidebar-label,
#sidebar.collapsed .sidebar-section-title { opacity: 0; max-width: 0; }

#main-content {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition);
}

#main-content.sidebar-collapsed { margin-left: 72px; }

/* ── Top Nav ── */
#topnav {
  position: sticky; top: 0; z-index: 30;
  height: 64px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  backdrop-filter: blur(12px);
}

/* ── Sidebar Nav Items ── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
}

.nav-item:hover { background: rgba(99,102,241,0.1); color: var(--color-accent-light); }
.nav-item.active { background: rgba(99,102,241,0.15); color: var(--color-accent-light); }
.nav-item .icon { width: 20px; height: 20px; flex-shrink: 0; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.125rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-accent);
  color: white;
  box-shadow: 0 4px 14px rgba(99,102,241,0.4);
}
.btn-primary:hover {
  background: var(--color-accent-light);
  box-shadow: 0 6px 20px rgba(99,102,241,0.5);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--color-surface-2);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover { background: var(--color-surface); }

.btn-danger {
  background: rgba(239,68,68,0.1);
  color: var(--color-danger);
  border: 1px solid rgba(239,68,68,0.25);
}
.btn-danger:hover { background: var(--color-danger); color: white; }

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}
.btn-ghost:hover { background: var(--color-surface-2); color: var(--color-text); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

/* ── Cards ── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover { box-shadow: var(--shadow); }

.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}

/* ── Calendar Grid ── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.calendar-day-header {
  background: var(--color-surface);
  padding: 0.625rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  text-align: center;
  border-bottom: 1px solid var(--color-border);
}

.calendar-day {
  background: var(--color-surface);
  min-height: 130px;
  padding: 0.625rem;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
  position: relative;
  transition: background var(--transition);
  cursor: pointer;
}

.calendar-day:hover { background: rgba(99,102,241,0.04); }
.calendar-day.other-month { opacity: 0.35; }
.calendar-day.today { background: rgba(99,102,241,0.07); }
.calendar-day.today .day-number {
  background: var(--color-accent);
  color: white;
  border-radius: 50%;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
}

.calendar-day.drag-over { background: rgba(99,102,241,0.12); outline: 2px dashed var(--color-accent); }

.day-number {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 0.375rem;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
}

/* ── Post Chips ── */
.post-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 500;
  margin-bottom: 3px;
  cursor: grab;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  user-select: none;
}
.post-chip:hover { filter: brightness(1.15); transform: scale(1.02); }
.post-chip:active { cursor: grabbing; }
.post-chip.dragging { opacity: 0.5; transform: rotate(2deg); }

/* Platform chip colors */
.chip-instagram { background: linear-gradient(90deg,rgba(253,89,73,0.2),rgba(214,36,159,0.2)); color:#fd5949; border: 1px solid rgba(253,89,73,0.3); }
.chip-facebook  { background: rgba(24,119,242,0.15); color: #1877F2; border: 1px solid rgba(24,119,242,0.3); }
.chip-linkedin  { background: rgba(10,102,194,0.15); color: #0A66C2; border: 1px solid rgba(10,102,194,0.3); }
.chip-tiktok    { background: rgba(105,201,208,0.15); color: #69C9D0; border: 1px solid rgba(105,201,208,0.3); }
.chip-twitter   { background: rgba(29,161,242,0.15); color: #1DA1F2; border: 1px solid rgba(29,161,242,0.3); }
.chip-pinterest { background: rgba(230,0,35,0.15); color: #E60023; border: 1px solid rgba(230,0,35,0.3); }
.chip-youtube   { background: rgba(255,0,0,0.15); color: #FF0000; border: 1px solid rgba(255,0,0,0.3); }
.chip-other     { background: rgba(148,163,184,0.15); color: #94a3b8; border: 1px solid rgba(148,163,184,0.3); }

/* Status dots */
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.status-dot.draft      { background: #94a3b8; }
.status-dot.scheduled  { background: #f59e0b; }
.status-dot.published  { background: #22c55e; }
.status-dot.approved   { background: #6366f1; }
.status-dot.failed     { background: #ef4444; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-panel {
  width: 520px;
  max-width: 100vw;
  height: 100vh;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 300ms cubic-bezier(0.4,0,0.2,1);
  box-shadow: var(--shadow-lg);
}
.modal-overlay.open .modal-panel { transform: translateX(0); }

/* Center Modal (for small dialogs) */
.modal-center {
  align-items: center;
  justify-content: center;
}
.modal-center .modal-dialog {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 480px;
  max-width: 95vw;
  transform: scale(0.9) translateY(20px);
  transition: transform 300ms cubic-bezier(0.4,0,0.2,1);
  box-shadow: var(--shadow-lg);
}
.modal-overlay.open .modal-dialog { transform: scale(1) translateY(0); }

/* ── Form Controls ── */
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: var(--radius-sm);
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.form-textarea { resize: vertical; min-height: 100px; }
.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 0.375rem;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-draft     { background: rgba(148,163,184,0.15); color: #94a3b8; }
.badge-scheduled { background: rgba(245,158,11,0.15);  color: #f59e0b; }
.badge-published { background: rgba(34,197,94,0.15);   color: #22c55e; }
.badge-approved  { background: rgba(99,102,241,0.15);  color: #818cf8; }
.badge-failed    { background: rgba(239,68,68,0.15);   color: #ef4444; }

/* ── Toast Notifications ── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
  min-width: 280px;
  max-width: 380px;
  pointer-events: all;
  animation: slideInRight 300ms cubic-bezier(0.4,0,0.2,1) forwards;
  font-size: 0.875rem;
  color: var(--color-text);
}
.toast.removing { animation: slideOutRight 300ms cubic-bezier(0.4,0,0.2,1) forwards; }
.toast.success .toast-icon { color: var(--color-success); }
.toast.error   .toast-icon { color: var(--color-danger); }
.toast.info    .toast-icon { color: var(--color-info); }
.toast.warning .toast-icon { color: var(--color-warning); }

@keyframes slideInRight {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes slideOutRight {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(110%); opacity: 0; }
}

/* ── Upload Drop Zone ── */
.drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.drop-zone:hover, .drop-zone.dragging {
  border-color: var(--color-accent);
  background: rgba(99,102,241,0.05);
  color: var(--color-accent-light);
}

/* ── Hashtag Tags ── */
.hashtag-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(99,102,241,0.12);
  color: var(--color-accent-light);
  border-radius: 99px;
  padding: 0.2rem 0.6rem;
  font-size: 0.775rem;
  font-weight: 500;
}
.hashtag-tag .remove-tag {
  cursor: pointer;
  width: 14px; height: 14px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  transition: background var(--transition);
}
.hashtag-tag .remove-tag:hover { background: rgba(239,68,68,0.3); }

/* ── Comment Thread ── */
.comment-bubble {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  max-width: 85%;
  font-size: 0.875rem;
  line-height: 1.5;
}
.comment-bubble.admin   { background: rgba(99,102,241,0.12); margin-left: auto; }
.comment-bubble.client  { background: var(--color-surface-2); }

/* ── Platform Account Cards ── */
.platform-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.platform-card.connected { border-color: rgba(34,197,94,0.3); }

/* ── Skeleton Loader ── */
.skeleton {
  background: linear-gradient(90deg, var(--color-surface) 25%, var(--color-surface-2) 50%, var(--color-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Weekly View ── */
.weekly-grid {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.time-slot {
  padding: 0.5rem;
  font-size: 0.7rem;
  color: var(--color-text-muted);
  text-align: right;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* ── Analytics Chart Container ── */
.chart-container { position: relative; height: 200px; }

/* ── Add Post Button in Day Cell ── */
.add-post-btn {
  position: absolute;
  bottom: 4px; right: 4px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--color-accent);
  color: white;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  border: none;
  line-height: 1;
  transition: all var(--transition);
}
.calendar-day:hover .add-post-btn { display: flex; }
.add-post-btn:hover { transform: scale(1.2); }

/* ── Responsive ── */
@media (max-width: 1024px) {
  #sidebar { width: 72px; min-width: 72px; }
  #sidebar .sidebar-label, #sidebar .sidebar-section-title { opacity: 0; max-width: 0; }
  #main-content { margin-left: 72px; }
}

@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); width: 260px; }
  #sidebar.mobile-open { transform: translateX(0); }
  #main-content { margin-left: 0; }
  .calendar-grid { grid-template-columns: repeat(7, 1fr); font-size: 0.75rem; }
  .calendar-day { min-height: 70px; padding: 0.25rem; }
  .day-number { font-size: 0.7rem; }
  .modal-panel { width: 100vw; }
}

/* ── Divider ── */
.divider { height: 1px; background: var(--color-border); margin: 1rem 0; }

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--color-text-muted);
}
.empty-state svg { width: 64px; height: 64px; opacity: 0.3; margin-bottom: 1rem; }

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 0 0 var(--color-accent-glow); }
  70% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
  100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.animate-fade { animation: fadeIn 400ms ease forwards; }
.animate-slide-up { animation: slideInUp 500ms cubic-bezier(0.16, 1, 0.3, 1) forwards; }

.hover-glow:hover {
  box-shadow: 0 0 20px var(--color-accent-glow);
  border-color: var(--color-accent);
}

/* Staggered entrance for list items */
.stagger-1 { animation-delay: 100ms; }
.stagger-2 { animation-delay: 200ms; }
.stagger-3 { animation-delay: 300ms; }
.stagger-4 { animation-delay: 400ms; }
.stagger-5 { animation-delay: 500ms; }

/* ── Progress dots ── */
.progress-ring { transition: stroke-dashoffset 0.5s; }
