* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(to bottom right, #18181b, #3b3b3b, #18181b);
  min-height: 100vh;
  color: #d4d4d8;
  overflow-x: hidden;
}

/* HEADER */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  padding-top: max(12px, env(safe-area-inset-top));
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
  border-bottom: 1px solid #27272a;
  background: rgba(24,24,27,0.95);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-img {
  width: 36px;
  height: 36px;
  background: #27272a;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.logo-text {
  font-family: 'Sora', sans-serif;
  font-size: 20px;
  color: #14b8a6;
}

.logo-sub {
  font-size: 10px;
  color: #d4d4d8;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  color: #d4d4d8;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.2s;
}

.nav-link2 {
  color: #d4d4d8;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.2s;
  border: 1px dashed #d4d4d8; color: #d4d4d8; 
}

.nav-link:hover { color: #f4f4f5; background: #27272a; }
.nav-link.active { color: #14b8a6; }

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #d4d4d8;
}

.btn-icon {
  background: none;
  border: none;
  color: #d4d4d8;
  font-size: 13px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
}

.btn-icon:hover { color: #f4f4f5; background: #27272a; }
.btn-icon.danger:hover { color: #f87171; background: rgba(239,68,68,0.1); }

/* BUTTONS */
.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: opacity 0.2s;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(to right, #14b8a6, #0d9488); color: white; }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary { background: #27272a; border: 1px solid #3f3f46; color: #f4f4f5; }
.btn-secondary:hover { border-color: #14b8a6; color: #14b8a6; }
.btn-ghost { background: none; border: 1px dashed #14b8a6; color: #d4d4d8; }
.btn-ghost2 { background: none; border: 1px dashed #d4d4d8; color: #14b8a6; }
.btn-ghost:hover { border-color: #14b8a6; color: #14b8a6; }
.btn-danger { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #f87171; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* CARDS */
.card {
  background: #1c1c1f;
  border: 1px solid #27272a;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}

.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid #27272a;
  font-size: 11px;
  font-weight: 600;
  color: #d4d4d8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.card-body { padding: 14px 16px; }

/* FORMS */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
textarea,
select {
  width: 100%;
  background: #27272a;
  border: 1px solid #3f3f46;
  color: #f4f4f5;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus { border-color: #14b8a6; }
input::placeholder, textarea::placeholder { color: #d4d4d8; }
textarea { resize: vertical; }
input[type="file"] { display: none; }

.form-group { margin-bottom: 14px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #d4d4d8;
  margin-bottom: 6px;
}

/* TOGGLE */
.toggle {
  width: 36px;
  height: 20px;
  background: #3f3f46;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
  border: none;
  flex-shrink: 0;
}

.toggle::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: left 0.2s;
}

.toggle.on { background: #14b8a6; }
.toggle.on::after { left: 19px; }

.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #d4d4d8;
}

/* STATUS BADGES */
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
}

.badge-ready      { background: rgba(245,158,11,0.15); color: #f59e0b; }
.badge-posted     { background: rgba(20,184,166,0.15); color: #14b8a6; }
.badge-error      { background: rgba(239,68,68,0.15);  color: #ef4444; }
.badge-processing { background: rgba(99,102,241,0.15); color: #818cf8; }
.badge-paused     { background: rgba(99,102,241,0.15); color: #818cf8; }

/* SECTION TITLE */
.section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #d4d4d8;
  margin-bottom: 10px;
}


/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #18181b;
  border: 1px solid #14b8a6;
  color: #f4f4f5;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show { opacity: 1; }

/* ERROR BOX */
.error-box {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #f87171;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

/* PAUSE BANNER */
.pause-banner {
  background: rgba(245,158,11,0.1);
  border-bottom: 1px solid rgba(245,158,11,0.3);
  color: #f59e0b;
  padding: 8px 20px;
  font-size: 13px;
  text-align: center;
  display: none;
}

.pause-banner.active { display: block; }

/* MAIN LAYOUT */
.main {
  display: flex;
  min-height: calc(100vh - 57px);
}

.page-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  transition: margin-right 0.3s ease;
}

.page-wrap.panel-open { margin-right: 0; }

.page-inner {
  max-width: 680px;
  margin: 0 auto;
}

/* CHANNEL CARDS */
.channel-bar {
  display: grid;
  grid-template-columns: repeat(10, 56px);
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.channel-card {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid #3f3f46;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #27272a;
  transition: all 0.2s;
  overflow: visible;
  flex-shrink: 0;
}

.channel-card img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  overflow: hidden;
}

.channel-card.fb { border-color: #1877f2; }
.channel-card.ig { border-color: #dd2a7b; }
.channel-card.selected.fb { box-shadow: 0 0 0 3px rgba(24,119,242,0.4); }
.channel-card.selected.ig { box-shadow: 0 0 0 3px rgba(221,42,123,0.4); }

.channel-card.google { border-color: #4285f4; }
.channel-card.google.selected { background: rgba(66,133,244,0.15); border-color: #4285f4; }

/* MEDIA THUMBS */
.media-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.media-thumb-wrap {
  position: relative;
  width: 72px;
  height: 72px;
}

.media-thumb-wrap img {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #3f3f46;
}

.media-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(239,68,68,0.85);
  border: none;
  color: white;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-add {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  border: 1px dashed #3f3f46;
  background: #27272a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #d4d4d8;
  font-size: 22px;
  transition: all 0.2s;
}

.media-add:hover { border-color: #14b8a6; color: #14b8a6; }

@media (max-width: 640px) {
  .channel-bar {
    display: flex;
    flex-wrap: wrap;
  }
}

/* POSTS PANEL */
.posts-panel {
  position: fixed;
  top: 57px;
  right: -360px;
  width: 360px;
  height: calc(100vh - 57px);
  background: #1c1c1f;
  border-left: 1px solid #27272a;
  transition: right 0.3s ease;
  overflow-y: auto;
  z-index: 90;
}

.posts-panel.open { right: 0; }

.posts-panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid #27272a;
  font-size: 13px;
  font-weight: 600;
  color: #d4d4d8;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: #1c1c1f;
  z-index: 1;
}

.posts-panel-header .btn-icon,
.library-panel-header .btn-icon {
  background: #27272a;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 16px;
}

.post-item {
  padding: 12px 16px;
  border-bottom: 1px solid #27272a;
  font-size: 13px;
}

.post-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}

.post-text-preview {
  color: #d4d4d8;
  line-height: 1.4;
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.post-meta {
  color: #d4d4d8;
  font-size: 11px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.posts-empty {
  padding: 32px 16px;
  text-align: center;
  color: #d4d4d8;
  font-size: 13px;
}

/* PREVIEW */
.preview-meta {
  padding: 10px 14px;
  border-bottom: 1px solid #27272a;
  font-size: 12px;
  color: #d4d4d8;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.preview-body {
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
  color: #d4d4d8;
  min-height: 60px;
  white-space: pre-wrap;
}

.preview-media-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
}

.preview-media-grid img {
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
}

.channel-card.selected::after {
  content: '✓';
  position: absolute;
  bottom: 13px;
  right: 13px;
  background: white;
  color: #66ff00;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  line-height: 1;
}

.channel-card {
  position: relative;
}

/* SCHEDULE ROW */
.schedule-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.schedule-fields {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.submit-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: #1c1c1f;
  border: 1px solid #3f3f46;
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 380px;
  transform: translateY(10px);
  transition: transform 0.2s;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: #f4f4f5;
  margin-bottom: 8px;
}

.modal-body {
  font-size: 14px;
  color: #d4d4d8;
  margin-bottom: 24px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* SITE FOOTER */
.site-footer {
  border-top: 1px solid #27272a;
  padding: 16px 20px;
  margin-top: auto;
}

.site-footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.footer-copy {
  font-size: 12px;
  color: #d4d4d8;
}

.footer-copy a {
  color: #d4d4d8;
  text-decoration: none;
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-links a {
  font-size: 12px;
  color: #d4d4d8;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover { color: #d4d4d8; }

/* LIBRARY PANEL */
.library-panel {
  position: fixed;
  top: 57px;
  left: -400px;
  width: 400px;
  height: calc(100vh - 57px);
  background: #1c1c1f;
  border-right: 1px solid #27272a;
  transition: left 0.3s ease;
  overflow-y: auto;
  z-index: 90;
  display: flex;
  flex-direction: column;
}

.library-panel.open { left: 0; }

.library-panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid #27272a;
  font-size: 13px;
  font-weight: 600;
  color: #d4d4d8;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: #1c1c1f;
  z-index: 1;
  flex-shrink: 0;
}

.library-filters {
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid #27272a;
  flex-shrink: 0;
}

.library-filter {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #a1a1aa;
  cursor: pointer;
  border: none;
  background: none;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
}

.library-filter2 {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #a1a1aa;
  cursor: pointer;
  border: 1px dashed #14b8a6; color: #d4d4d8; 
  background: none;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
}

.library-filter-hidden {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #a1a1aa;
  cursor: pointer;
  border: 1px dashed #d4d4d8; color: #d4d4d8; 
  background: none;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
}

.library-filter.active {
  background: #27272a;
  color: #f4f4f5;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 12px;
  flex: 1;
  grid-auto-rows: min-content;
}

.library-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: #27272a;
}

.library-item img,
.library-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.library-item:hover .library-item-overlay {
  opacity: 1;
}

.library-item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 0.2s;
}

.library-item-add {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(20,184,166,0.85);
  border: none;
  color: white;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.library-item-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(239,68,68,0.85);
  border: none;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.library-empty {
  padding: 40px 16px;
  text-align: center;
  color: #71717a;
  font-size: 13px;
  grid-column: 1/-1;
}

.library-video-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(0,0,0,0.7);
  color: white;
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 3px;
  font-weight: 600;
}

/* LIGHTBOX */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.lightbox-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  opacity: 0.7;
  line-height: 1;
}

.lightbox-close:hover { opacity: 1; }

/* MOBILE */
@media (max-width: 640px) {
  .page-wrap.panel-open { margin-right: 0; }
  .posts-panel { width: 100%; right: -100%; }
  .header-nav { display: none; }
}

@media (max-width: 640px) {
  .schedule-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  #submitBtn {
    font-size: 12px;
    padding: 6px 10px;
  }
  #postsToggle {
    font-size: 12px;
    padding: 6px 10px;
  }
}

@media (max-width: 640px) {
  .modal {
    max-height: 85vh;
    border-radius: 12px;
    padding: 20px;
  }
}

/* HAMBURGER */
.hamburger {
  display: none;
  background: none;
  border: none;
  color: #d4d4d8;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
}

.desktop-only { display: flex; align-items: center; gap: 8px; }

.mobile-menu {
  display: none;
  position: fixed;
  top: 57px;
  left: 0;
  right: 0;
  background: #1c1c1f;
  border-bottom: 1px solid #27272a;
  z-index: 99;
  flex-direction: column;
  padding: 8px 0;
}

.mobile-menu.open { display: flex; }

.mobile-menu a {
  padding: 14px 20px;
  color: #d4d4d8;
  text-decoration: none;
  font-size: 15px;
  border-bottom: 1px solid #27272a;
  transition: background 0.2s;
}

.mobile-menu a:hover { background: #27272a; }
.mobile-menu a:last-child { border-bottom: none; color: #f87171; }

@media (max-width: 640px) {
  .hamburger { display: block; }
  .desktop-only { display: none !important; }
  .header-nav { display: none; }
}

@media (max-width: 640px) {
  .pixabay-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* PWA safe area — mobile only */
@media (max-width: 640px) {
  body {
    padding-top: env(safe-area-inset-top);
  }
}

/* Global text color override */
body { color: #d4d4d8; }

.wm-pos-btn {
  background:#27272a;border:1px solid #3f3f46;color:#a1a1aa;
  border-radius:6px;padding:8px;cursor:pointer;font-size:14px;
  transition:all 0.15s;
}
.wm-pos-btn:hover { border-color:#14b8a6;color:#14b8a6; }
.wm-pos-btn.active { background:#14b8a6;border-color:#14b8a6;color:white; }

.channel-card.bluesky { border-color: #00c6ff; }
.channel-card.bluesky.selected { box-shadow: 0 0 0 3px rgba(0,198,255,0.4); }

.channel-card.linkedin { border-color: #0a66c2; }
.channel-card.linkedin.selected { box-shadow: 0 0 0 3px rgba(10,102,194,0.4); }



