@import url('https://fonts.googleapis.com/css2?family=Corinthia:wght@700&display=swap');

/* === Modern Full Layout - Fixed Video Header + Sidebar Fit === */

/* === Reset === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* === Default Times Styling === */
.default-time-label {
  font-size: 0.75rem;
  line-height: 1.4;
  color: #666;
  margin: 0.5rem 0;
  padding: 0.25rem 0.5rem;
  background: #f8f9fa;
  border-radius: 4px;
  border-left: none !important;
  white-space: pre-line;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

.default-time-label:empty {
  display: none;
}

.times-badge {
  font-size: 0.7rem;
  line-height: 1.3;
  color: #555;
  margin: 0.25rem 0;
  padding: 0.2rem 0.4rem;
  background: #f0f2f5;
  border-radius: 3px;
  border-left: 2px solid #28a745;
  white-space: pre-line;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

.times-badge:empty {
  display: none;
}

/* === Modal Styles === */
.buffer-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.buffer-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.buffer-modal-content {
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.buffer-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #eee;
  background: #f8f9fa;
}

.buffer-modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #333;
}

.buffer-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.buffer-modal-close:hover {
  background-color: #f0f0f0;
}

.buffer-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

/* Group Management Styles */
.page-groups-wrapper {
  margin-bottom: 1rem;
}

.page-groups-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.group-action-buttons {
  display: flex;
  gap: 0.5rem;
}

.btn-black {
  background: #333;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-black:hover {
  background: #555;
}

.btn-secondary {
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-secondary:hover {
  background: #5a6268;
}

html, body {
  height: 100vh;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  color: #111;
  background-color: #f9fafb;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  height: 100vh;
  overflow: hidden;
}

/* === Header Video === */
.header-video {
  position: relative;
  width: 100%;
  height: 80px;
  overflow: hidden;
  z-index: 0;
}

.header-video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* === Layout === */
#mainContainer {
  display: grid !important;
  grid-template-columns: 340px 1fr 340px !important;
  gap: 0;
  width: 100vw;
  height: calc(100vh - 80px);
  margin-top: 0;
  overflow: visible !important;
}

@media (max-width: 1100px) {
  #mainContainer {
    grid-template-columns: 250px 1fr 250px;
  }
}

@media (max-width: 900px), (max-width: 768px) {
  #mainContainer {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
  }
}

@media (min-width: 1101px) {
  #mainContainer {
    grid-template-columns: 340px 1fr 340px;
  }
}

.sidebar {
  width: 340px;
  min-width: 260px;
  max-width: 400px;
  padding: 24px 18px 0 18px;
  border: none !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  background: #fff;
  height: 100% !important;
  max-height: 100vh !important;
  overflow-y: auto !important;
  display: flex;
  flex-direction: column;
  position: relative;
}

.sidebar h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #eee;
  padding-bottom: 0.5rem;
}

.sidebar input[type="text"] {
  margin-bottom: 0.7rem;
}

#content, .main-content-area {
  height: 100%;
  overflow: auto;
  display: block;
  padding: 0.5rem;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  z-index: 1;
  scroll-margin-top: 120px;
  background: none;
}

/* Scheduled posts container: let internal .posts-grid control layout */
#scheduledPostsContainer {
  display: block !important;
  padding: 0 24px 48px 8px !important; /* right and bottom breathing room */
  margin: 0 !important;
  width: 100% !important;
  max-width: none !important; /* remove 1200px cap that caused right gap */
  box-sizing: border-box !important;
  overflow: visible !important;
}

.toolbar-wrapper {
  min-height: 80px;
}

#content.previews-active {
  padding-top: 2rem;
  padding-bottom: 5rem;
}

/* === Components === */
.main-content-area,
.main-content-card,
.profile-container {
  background: #f7f7f7;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  padding: 0.2rem;
  margin: 0 auto 0.2rem;
  width: 100%;
  max-width: 960px;
  box-sizing: border-box;
}

/* === Sidebar Fix === */
.sidebar h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #eee;
  padding-bottom: 0.5rem;
}

.sidebar input[type="text"] {
  margin-bottom: 0.7rem;
}

.sidebar .profile-container {
  margin-bottom: 0.5rem;
}

.profile-container:hover {
  box-shadow: 0 6px 24px rgba(191, 161, 74, 0.13);
  transform: translateY(-2px) scale(1.01);
}

/* === Buttons === */
.btn,
.elegant-btn,
.toolbar-wrapper button,
.toolbar-wrapper select {
  background: #fff;
  color: #222;
  border: 1px solid #020202;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.5rem 1.2rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: all 0.2s;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover,
.elegant-btn:hover {
  background: #f3f4f6;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.btn-primary {
  background: #fff !important;
  color: #222 !important;
  border: 1.5px solid #848484 !important;
  box-shadow: none !important;
  border-radius: 6px !important;
  font-weight: 500;
  font-size: 0.97rem;
  padding: 0.45rem 1.1rem;
  transition: background 0.2s, border 0.2s;
}

.btn-primary:hover {
  background: #2e2e2e !important;
  color: #ffffff !important;
  border-color: #959595 !important;
  box-shadow: none !important;
}

.elegant-btn, .csv-upload-btn, .ignore-default-label input[type="checkbox"] + label, .csv-actions-group button {
  background: #fff !important;
  color: #222 !important;
  border: 1.5px solid #848484 !important;
  box-shadow: none !important;
  border-radius: 6px !important;
  font-weight: 500;
  font-size: 0.97rem;
  padding: 0.45rem 1.1rem;
  transition: background 0.2s, border 0.2s;
}

.elegant-btn:hover, .csv-upload-btn:hover, .csv-actions-group button:hover {
  background: #2e2e2e !important;
  color: #ffffff !important;
  border-color: #959595 !important;
  box-shadow: none !important;
}

.ignore-default-label input[type="checkbox"] {
  accent-color: #bfa14a;
  margin-right: 0.3rem;
}

/* === Inputs === */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  background: #f7f7fa;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  font-size: 0.97rem;
  transition: border 0.2s;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border: 1.5px solid #bfa14a;
  box-shadow: 0 0 0 3px rgba(191, 161, 74, 0.1);
  outline: none;
}

/* === Utility === */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-4 { margin-top: 1rem; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }

/* === Scrollbars === */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-thumb {
  background: #e4e6eb;
  border-radius: 4px;
}

/* === Toast === */
.status-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  max-width: 300px;
}

/* --- ULTRA-COMPACT SIDEBAR CARDS --- */
.profile-container {
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(191,161,74,0.04);
  background: #fff !important;
  padding: 0.8rem;
  margin-bottom: 0.8rem;
  min-height: 60px;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  font-size: 0.92rem;
  width: 100%;
  transition: box-shadow 0.2s, transform 0.2s;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  overflow: visible !important;
  transition: order 0.25s ease, transform 0.2s ease;
}

.profile-container.active-group-page {
  background: #f0f8ff;
  border-left: 4px solid #4CAF50;
}
.profile-header {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  width: 100%;
  min-height: 20px;
}
.profile-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 0.1rem;
  border: 2px solid transparent;
}

.profile-avatar.facebook {
  border: 3px solid #1877f2;
  box-shadow: 0 0 0 1px rgba(24, 119, 242, 0.3);
}

.profile-avatar.instagram {
  border: 3px solid #e4405f;
  box-shadow: 0 0 0 1px rgba(228, 64, 95, 0.3);
}
.profile-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.01rem;
  overflow: hidden;
}
.page-name {
  display: block;
  font-size: 0.8rem;
  color: #1c1e21;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
  margin-bottom: 2px;
}
.platform-badge, .badge {
  display: inline-block;
  margin: 2px 0 0 0;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: white;
  width: fit-content;
  min-width: 60px;
  text-align: center;
}

.platform-badge.facebook {
  background: linear-gradient(135deg, #1877f2 0%, #0d6efd 100%);
  box-shadow: 0 1px 3px rgba(24, 119, 242, 0.3);
}

.platform-badge.instagram {
  background: linear-gradient(135deg, #e4405f 0%, #c13584 50%, #833ab4 100%);
  box-shadow: 0 1px 3px rgba(228, 64, 95, 0.3);
}
.profile-container button, .profile-container .action-btn {
  font-size: 0.85rem !important;
  padding: 0.18em 0.5em !important;
  margin-right: 0.2em !important;
  border-radius: 5px !important;
}
/* --- END ULTRA-COMPACT SIDEBAR CARDS --- */

/* --- CALENDAR FILL FIX --- */
.main-content-card {
  flex: 1;
  height: 100%;
  overflow-y: visible;
  display: flex;
  flex-direction: column;
}

/* --- FullCalendar Container Fix --- */
#calendarContainer {
  position: relative;
  background: #fff;
  height: calc(100vh - 180px); /* adjust for header/footer as needed */
  overflow: visible;
  z-index: 1;
  margin-top: 1rem;
  min-height: 600px !important;
  height: 600px !important;
}

/* Ensure calendar is hidden when previews are active */
#calendarContainer.hidden,
#calendarContainer[style*="display: none"] {
  display: none !important;
}

#calendar {
  min-height: 600px !important;
  height: 100% !important;
}

#calendarContainer .fc {
  height: 100%;
}

/* Remove problematic overrides */
/* DO NOT override display/grid/table/flex for FullCalendar internals! */
/* Remove any display: block !important, height: auto !important, z-index: 9999 !important, etc. from .fc-daygrid, .fc-daygrid-body, .fc-scrollgrid, .fc-daygrid-day, etc. */

/* Optional: keep day cell styling for visibility */
#calendarContainer .fc-daygrid-day {
  background: #fff;
  border: 1px solid #e0e0e0;
  min-height: 44px;
  color: #222;
}

#calendarContainer .fc-daygrid-day-number {
  color: #222;
  font-weight: 500;
  background: none;
  z-index: 2;
  position: relative;
}

/* Remove any forced background on .fc-view-harness-active */
#calendarContainer .fc-view-harness-active {
  background: none !important;
}

/* Basic FullCalendar styling */
#calendarContainer .fc-header-toolbar {
  margin-bottom: 1rem !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
}

#calendarContainer .fc-toolbar-title {
  font-size: 1.5rem !important;
  font-weight: bold !important;
  color: #333 !important;
}

/* Center the FullCalendar month title */
#calendarContainer .fc-toolbar-title {
  margin: 0 auto !important;
  text-align: center !important;
  display: block !important;
  width: fit-content !important;
  float: none !important;
}

@import url('https://fonts.googleapis.com/css2?family=Corinthia:wght@700&display=swap');

#calendarContainer .fc-toolbar-title {
  font-family: 'Corinthia', serif !important;
  font-size: 3.3rem !important;
  font-weight: 700 !important;
  color: #222 !important;
  letter-spacing: 0.02em;
  line-height: 1.2 !important;
  white-space: nowrap;
  overflow: visible;
  max-width: none;
}
#calendarContainer .fc-toolbar-title::after {
  content: "";
  display: inline;
}
#calendarContainer .fc-button,
#calendarContainer .fc-button-primary {
  background: #111 !important;
  color: #fff !important;
  border: 1.5px solid #111 !important;
  border-radius: 10px !important;
  font-size: 1rem !important;
  font-weight: 500 !important;
  box-shadow: none !important;
  padding: 0.45rem 1.1rem !important;
  margin: 0 0.1rem !important;
  transition: background 0.2s, border 0.2s;
}
#calendarContainer .fc-button:hover,
#calendarContainer .fc-button-primary:hover {
  background: #333 !important;
  border-color: #333 !important;
  color: #fff !important;
}
#calendarContainer .fc-button:focus {
  outline: none !important;
  box-shadow: 0 0 0 2px #bfa14a33 !important;
}
#calendarContainer .fc-button.fc-dayGridDay-button,
#calendarContainer .fc-button[data-view="day"] {
  display: none !important;
}


.sidebar .profile-img {
  width: 40px !important;
  height: 40px !important;
  margin: 0 0.1rem 0 0 !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  display: block !important;
}

/* Sidebar scrollbars: use default system color and matching height */
.sidebar::-webkit-scrollbar {
  width: 8px !important;
  background: #f0f0f0 !important;
}
.sidebar::-webkit-scrollbar-thumb {
  background: #e4e6eb;
  border-radius: 4px;
}
#instagramSidebar {
  height: 100% !important;
  max-height: 100vh !important;
  overflow-y: auto !important;
}
#facebookSidebar {
  height: 100% !important;
  max-height: 100vh !important;
  overflow-y: auto !important;
}

#facebookPages, #instagramPages {
  display: flex !important;
  flex-direction: column !important;
}

#facebookPages .profile-container, #instagramPages .profile-container {
  order: 999;
}

/* Ensure containers with lower order values appear first */
#facebookPages .profile-container[style*="order: 0"],
#instagramPages .profile-container[style*="order: 0"] {
  order: 0;
}

#facebookPages .profile-container[style*="order: 1"],
#instagramPages .profile-container[style*="order: 1"] {
  order: 1;
}

#facebookPages .profile-container[style*="order: 2"],
#instagramPages .profile-container[style*="order: 2"] {
  order: 2;
}

/* --- CONSOLIDATED TOOLBAR & BUTTON STYLES --- */
.toolbar-wrapper {
  background: #ffffff;
  padding: 1rem 1.25rem;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  min-height: 70px;
}

.toolbar-wrapper button,
.toolbar-wrapper select {
  background: #ffffff;
  color: #333;
  border: 1.5px solid #cfcfcf;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 1rem;
  transition: all 0.2s ease;
}
.toolbar-wrapper button:hover {
  background: #f3f4f6;
  border-color: #aaa;
  color: #111;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.btn,
.elegant-btn {
  border-radius: 10px !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  background: #fff;
  color: #222;
  border: 1.5px solid #848484;
  font-weight: 600;
  font-size: 0.97rem;
  padding: 0.45rem 1.1rem;
  box-shadow: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover,
.elegant-btn:hover {
  background: #f3f4f6;
  color: #111;
  border-color: #959595;
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0,0,0,0.05);
}

.btn,
.elegant-btn,
.btn-secondary,
select.btn.btn-secondary {
  font-weight: 500 !important;
}

#groupSelect,
#previewBtn,
#scheduleBtn,
#showAllBtn {
  font-weight: 500 !important;
}

#groupSelect.btn.btn-secondary {
  min-width: 260px;
  flex: 0 0 260px;
  padding: 0.4rem 0.7rem;
  font-size: 1rem;
  border-radius: 10px;
  border: 1.5px solid #e0e0e0;
  background: #f7f7fa;
  color: #222;
  box-shadow: 0 1px 3px rgba(191,161,74,0.04);
}

.group-action-buttons {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.2rem;
  width: 100%;
}

.group-action-buttons .btn-black {
  background: transparent;
  color: #888;
  border: 1.2px solid #e0e0e0;
  border-radius: 7px;
  padding: 0.12rem 0.3rem;
  font-size: 0.95em;
  box-shadow: none;
  display: flex;
  align-items: center;
  transition: background 0.15s, border 0.15s, color 0.15s;
  width: auto;
  max-width: 180px;
  min-width: 0;
  justify-content: center;
}

.group-action-buttons .btn-black:hover {
  background: #f5f5f5;
  color: #444;
  border-color: #d3d3d3;
}

.group-action-buttons .btn-black svg {
  width: 16px !important;
  height: 16px !important;
  color: #888 !important;
  stroke: #888 !important;
  margin: 0;
  padding: 0;
  line-height: 1;
  display: block;
}

.group-dropdown-flex-col {
  flex: 0 0 auto;
  margin-right: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  min-width: 260px;
}

.csv-controls-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.3rem !important;
}

#dropZone,
#dropZone.wide-dropzone {
  flex: 0 0 auto;
  width: auto;
  max-width: 350px;
  border: 2.5px dashed #b0b0b0;
  background: #fefefe;
  color: #666;
  border-radius: 10px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 0;
  margin-right: 0;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  min-height: 48px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  box-shadow: 0 1px 6px 0 rgba(107,114,128,0.04);
}

#buttonContainer {
  display: flex;
  gap: 0.3rem;
  margin-left: 0;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

#newPostBtn.elegant-btn {
  min-width: 140px;
  width: 140px;
  display: inline-block;
}

/* Remove or comment out styles for #postTypeAllMain.elegant-btn */
/* #postTypeAllMain.elegant-btn {
  min-width: 140px;
  width: 140px;
  display: inline-block;
} */

.sidebar-action-btn, .watermark-btn {
  background: #fff !important;
  color: #222 !important;
  border: 1.2px solid #b0b0b0 !important;
  border-radius: 7px !important;
  font-weight: 400 !important;
  font-size: 0.93rem !important;
  padding: 0.22em 0.7em !important;
  box-shadow: none !important;
  transition: background 0.18s, border 0.18s, color 0.18s;
  margin-right: 0.18em !important;
  margin-bottom: 0.1em !important;
  outline: none !important;
}
.sidebar-action-btn:hover, .watermark-btn:hover {
  background: #f3f4f6 !important;
  color: #111 !important;
  border-color: #888 !important;
}

/* Force-hide profile containers if JS sets display: none */
.profile-container[style*="display: none"] {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

#timeModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
}

#timeModal.active {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

#timeModal .modal-content {
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  max-width: 500px;
  width: 90%;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Force all modals to show when not .hidden and display: block/flex is set by JS */
.modal:not(.hidden)[style*="display: block"],
.modal:not(.hidden)[style*="display: flex"],
.watermark-modal:not(.hidden)[style*="display: block"],
.watermark-modal:not(.hidden)[style*="display: flex"] {
  display: block !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  z-index: 2000 !important;
}

/* Loading indicator for preview generation */
.loading-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  font-size: 1.1rem;
  color: #666;
  background: #f8f9fa;
  border-radius: 12px;
  border: 2px dashed #dee2e6;
  grid-column: 1 / -1;
  min-height: 200px;
}

.loading-indicator::before {
  content: "⏳";
  margin-right: 0.5rem;
  animation: spin 1s linear infinite;
}

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

#watermarkModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-out;
}

#watermarkModal:not(.hidden)[style*="display: flex"] {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

#watermarkModal .modal-content {
  background-color: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 90%;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
  animation: slideUp 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Watermark modal specific styles */
#watermarkModal .close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 2rem;
  font-weight: bold;
  color: #999;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s ease;
}

#watermarkModal .close:hover {
  color: #333;
}

#watermarkModal h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #222;
  text-align: center;
}

#watermarkModal #watermarkPreviewContainer {
  text-align: center;
  margin: 1rem 0;
}

#watermarkModal #watermarkPreview {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border: 2px solid #f0f0f0;
}

#watermarkModal #noWatermarkMsg {
  color: #999;
  font-style: italic;
  margin-top: 1rem;
}

#watermarkModal input[type="file"] {
  padding: 0.75rem;
  border: 2px dashed #ddd;
  border-radius: 8px;
  background: #fafafa;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

#watermarkModal input[type="file"]:hover {
  border-color: #999;
}

#watermarkModal .elegant-btn {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s ease;
}

#watermarkModal .elegant-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#watermarkModal .watermark-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1rem;
}

/* Toast Notification System */
.toast-container {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.toast {
  background: #fff;
  border-radius: 8px;
  padding: 1rem 1.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  border-left: 4px solid #10b981;
  min-width: 300px;
  animation: slideInRight 0.3s ease-out;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toast.success {
  border-left-color: #10b981;
}

.toast.error {
  border-left-color: #ef4444;
}

.toast.warning {
  border-left-color: #f59e0b;
}

.toast .toast-icon {
  font-size: 1.25rem;
}

.toast .toast-message {
  flex: 1;
  font-weight: 500;
  color: #333;
}

.toast .toast-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #999;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.toast .toast-close:hover {
  color: #333;
}

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

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

/* Modal wrapper */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  transition: opacity 0.25s cubic-bezier(0.4,0,0.2,1);
  opacity: 0;
}

#timeModal.active,
.modal.active {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Modal box */
.modal-box {
  background: #fff;
  border-radius: 12px;
  max-width: 480px;
  width: 95%;
  padding: 1.5rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: slideFadeIn 0.3s ease-out;
}
@keyframes slideFadeIn {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Header */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: #222;
}
.modal-close {
  font-size: 1.5rem;
  color: #888;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0 0.5rem;
}

/* Footer */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Time inputs */
.time-input {
  width: 100%;
  padding: 0.6rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 1rem;
  margin-top: 0.25rem;
  margin-bottom: 0.75rem;
}

/* Checkbox layout */
.day-checks {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.day-checks label {
  font-size: 0.85rem;
}

/* Modal overlay for click-outside */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: transparent;
}

@media (max-width: 600px) {
  .modal-box {
    max-width: 98vw;
    padding: 1rem;
  }
  .modal-header h2 {
    font-size: 1rem;
  }
}

/* === Unified Post Card & Preview Styles (Cleaned) === */
.preview-card,
.scheduled-post,
.ig-post-card {
  position: relative;
  z-index: 2;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: all 0.2s ease;
  border: 1px solid #e5e7eb;
  min-height: 420px;
  overflow: visible;
}

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

/* --- Preview Card Image Aspect Ratio Fix --- */
.preview-image-container, .post-image-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1080 / 1350;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #f9fafb;
  height: auto;
  min-height: 200px;
}

.preview-image,
.preview-image img,
.post-image-container img {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
  max-height: 400px;
}

.preview-image img:hover {
  transform: scale(1.02);
}

/* --- Modern Preview Card Header and Badges --- */
.preview-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.75rem 0 0.5rem 0;
  border-bottom: 1px solid #f0f0f0;
  min-height: 38px;
}

.page-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}
.platform-badge, .badge, .posttype-badge {
  display: inline-block;
  margin: 0 0.25rem 0 0;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: white;
  min-width: 70px;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(24, 119, 242, 0.08);
}
.platform-badge.facebook {
  background: linear-gradient(135deg, #1877f2 0%, #0d6efd 100%);
}
.platform-badge.instagram {
  background: linear-gradient(135deg, #e4405f 0%, #c13584 50%, #833ab4 100%);
}
.posttype-badge.reel {
  background: #f59e42;
}
.posttype-badge.story {
  background: #7c3aed;
}
.posttype-badge.post {
  background: #2563eb;
}

.preview-name {
  font-weight: 600;
  color: #1a1a1a;
  font-size: 1.05rem;
  margin-right: auto;
  margin-left: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.preview-info {
  flex: 1;
  margin-left: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* === Enhanced Preview Card Content & Grid Styles === */
.preview-content {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.preview-caption {
  margin-bottom: 12px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.4;
}
.preview-caption p {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  color: #333;
}

.preview-schedule {
  margin-bottom: 8px;
  color: #666;
  font-size: 13px;
}
.preview-schedule p {
  margin: 0;
  font-size: 13px;
  color: #666;
}

.preview-hashtags {
  margin-top: auto;
  color: #4f46e5;
  font-size: 13px;
}
.preview-hashtags p {
  margin: 0;
  color: #4f46e5;
  font-size: 13px;
}

.preview-actions {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid #eee;
  background: #fafafa;
}
.preview-actions button {
  background: #4f46e5;
  color: white;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.preview-actions button:hover {
  background: #4338ca;
}
.preview-actions button.secondary {
  background: #6b7280;
}
.preview-actions button.secondary:hover {
  background: #4b5563;
}

/* --- Preview Grid Container --- */
#previewContainer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  overflow-y: auto;
  max-height: calc(100vh - 220px); /* adjust as needed for your header/footer */
  padding: 24px;
  background: #fafbfc;
  box-sizing: border-box;
}

/* --- Preview Card --- */
.preview-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 280px;
  max-width: 340px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  transition: box-shadow 0.2s;
}

.preview-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* --- Responsive tweaks --- */
@media (max-width: 900px) {
  #previewContainer {
    grid-template-columns: 1fr;
    padding: 12px;
  }
  .preview-card {
    min-width: 0;
    max-width: 100%;
    padding: 10px;
  }
}

/* === Video Aspect Ratio Styles === */
.preview-wrapper.aspect-reel {
  position: relative;
  width: 100%;
  padding-top: 177.78%; /* 9:16 aspect ratio (16/9 = 1.7778) */
  background: #000;
  overflow: hidden;
  border-radius: 12px;
}

.preview-wrapper.aspect-reel video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.preview-image-container {
  margin-bottom: 1rem;
}

.read-more-btn {
  background: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  cursor: pointer;
  margin-top: 0.25rem;
  transition: background-color 0.2s;
}

.read-more-btn:hover {
  background: #0056b3;
}

.edit-modal,
.confirm-modal {
  display: none !important;
}
.edit-modal.active,
.confirm-modal.active {
  display: block !important;
}
body .edit-modal,
body .confirm-modal {
  display: none !important;
  position: fixed !important;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
}
body .edit-modal.active,
body .confirm-modal.active {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

/* === Enhanced Media Library Styles === */
.enhanced-media-library {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.enhanced-media-library .media-library-modal {
  animation: slideInFromTop 0.3s ease-out;
}

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

.enhanced-media-library .media-card {
  transition: all 0.2s ease;
}

.enhanced-media-library .media-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.enhanced-media-library .media-checkbox {
  cursor: pointer;
}

.enhanced-media-library .media-type-badge {
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.enhanced-media-library .media-preview {
  position: relative;
}

.enhanced-media-library .media-preview::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.enhanced-media-library .media-card:hover .media-preview::before {
  opacity: 1;
}

.enhanced-media-library .media-actions button {
  transition: all 0.2s ease;
}

.enhanced-media-library .media-actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.enhanced-media-library #uploadArea {
  transition: all 0.3s ease;
}

.enhanced-media-library #uploadArea:hover {
  border-color: #d6aeb6;
  background: #f8f9fa;
}

.enhanced-media-library #uploadProgress {
  transition: all 0.3s ease;
}

.enhanced-media-library #uploadProgressBar {
  transition: width 0.3s ease;
}

/* Responsive design for media library */
@media (max-width: 768px) {
  .enhanced-media-library .media-library-modal {
    margin: 1rem;
    max-width: calc(100vw - 2rem);
  }
  
  .enhanced-media-library #mediaGrid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  }
  
  .enhanced-media-library .media-library-toolbar {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .enhanced-media-library .media-library-toolbar > div {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .enhanced-media-library #mediaGrid {
    grid-template-columns: 1fr;
  }
  
  .enhanced-media-library .media-actions {
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .enhanced-media-library .media-actions button {
    width: 100%;
  }
}

/* === Shuffle Content Feature === */
.shuffle-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 16px;
}

.shuffle-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #4f46e5;
}

.shuffle-option label {
  font-size: 14px;
  color: #333;
  cursor: pointer;
  user-select: none;
  font-weight: 500;
}

.shuffle-tooltip {
  position: relative;
  display: inline-block;
}

.shuffle-tooltip .tooltip-text {
  visibility: hidden;
  width: 280px;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 8px;
  position: absolute;
  z-index: 1000;
  bottom: 125%;
  left: 50%;
  margin-left: -140px;
  font-size: 12px;
  line-height: 1.4;
  opacity: 0;
  transition: opacity 0.3s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.shuffle-tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

.shuffle-tooltip .tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #333 transparent transparent transparent;
}

/* Responsive adjustments for shuffle option */
@media (max-width: 768px) {
  .shuffle-option {
    margin-left: 8px;
    flex-wrap: wrap;
  }
  
  .shuffle-tooltip .tooltip-text {
    width: 240px;
    margin-left: -120px;
  }
}

/* Ensure the preview grid/container expands to fit all cards */
/* === Simple Editable Image Editor Styles === */
.simple-editor-modal {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.simple-editor-modal .editable {
  position: absolute;
  padding: 4px;
  cursor: move;
  border: 1px dashed transparent;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 2px;
  min-width: 20px;
  min-height: 20px;
  z-index: 100;
}

.simple-editor-modal .editable:focus {
  border: 1px dashed #2196f3;
  outline: none;
  background: rgba(255, 255, 255, 0.9);
}

.preview-grid, .preview-container {
  min-height: 600px;
  height: auto !important;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.7; }
  100% { opacity: 1; }
}

/* Progress bar for large preview sets */
.progress-bar {
  width: 100%;
  max-width: 400px;
  height: 20px;
  background-color: #f0f0f0;
  border-radius: 10px;
  margin: 10px auto;
  overflow: hidden;
  border: 1px solid #ddd;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4CAF50, #45a049);
  transition: width 0.3s ease;
  border-radius: 10px;
}

.progress-text {
  margin-top: 10px;
  font-weight: 500;
}

/* === SCHEDULED POSTS GRID LAYOUT === */
#scheduledPostsContainer {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 1.5rem !important;
  padding: 1rem !important;
  max-width: 1200px !important;
  margin: 0 auto !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.scheduled-post-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  padding: 1rem;
  border: 1px solid #e5e7eb;
  transition: all 0.2s ease;
  box-sizing: border-box !important;
  display: flex;
  flex-direction: column;
  overflow: visible;
  position: relative;
  width: 100% !important;
}

.scheduled-post-card:hover {
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

/* Post Header */
.scheduled-post-card .post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #f0f0f0;
}

.scheduled-post-card .page-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.scheduled-post-card .page-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.scheduled-post-card .page-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.scheduled-post-card .page-name {
  font-weight: 600;
  color: #1a1a1a;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.scheduled-post-card .status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: white;
  white-space: nowrap;
}

.scheduled-post-card .status-badge.scheduled {
  background: #2563eb;
}

.scheduled-post-card .status-badge.published {
  background: #16a34a;
}

.scheduled-post-card .status-badge.failed {
  background: #dc2626;
}

.scheduled-post-card .status-badge.pending {
  background: #f59e0b;
}

/* Media Container */
.scheduled-post-card .post-media-container {
  position: relative;
  width: 100%;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.scheduled-post-card .post-media {
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}

.scheduled-post-card .video-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  pointer-events: none;
}

/* Post Content */
.scheduled-post-card .post-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 120px; /* ensure room for meta + buttons */
}

.scheduled-post-card .post-caption {
  font-size: 0.875rem;
  line-height: 1.5;
  color: #333;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-height: 120px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  line-clamp: 3;
  margin-bottom: 0.5rem;
}

.scheduled-post-card .post-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #666;
}

.scheduled-post-card .scheduled-time {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #2563eb;
  background: #eff6ff;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid #dbeafe;
  margin-top: 0.5rem;
}

.scheduled-post-card .scheduled-time svg {
  color: #2563eb;
  flex-shrink: 0;
}

.scheduled-post-card .post-type-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: white;
  background: #6b7280;
}

.scheduled-post-card .post-type-badge.reel {
  background: #f59e42;
}

.scheduled-post-card .post-type-badge.story {
  background: #7c3aed;
}

.scheduled-post-card .post-type-badge.post {
  background: #2563eb;
}

.scheduled-post-card .error-message {
  font-size: 0.8rem;
  color: #dc2626;
  background: #fef2f2;
  padding: 0.5rem;
  border-radius: 4px;
  border: 1px solid #fecaca;
}

/* Post Actions */
.scheduled-post-card .post-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f0f0f0;
  margin-top: auto; /* push actions to bottom of card content */
}

.scheduled-post-card .action-btn {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.scheduled-post-card .edit-btn {
  background: #2563eb;
  color: white;
}

.scheduled-post-card .edit-btn:hover:not(:disabled) {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.scheduled-post-card .edit-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.scheduled-post-card .delete-btn {
  background: #dc2626;
  color: white;
}

.scheduled-post-card .delete-btn:hover {
  background: #b91c1c;
  transform: translateY(-1px);
}

.scheduled-post-card .retry-btn {
  background: #f59e0b;
  color: white;
}

.scheduled-post-card .retry-btn:hover {
  background: #d97706;
  transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 1200px) {
  #scheduledPostsContainer {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem !important;
    padding: 1rem !important;
    box-sizing: border-box !important;
  }
  
  .scheduled-post-card {
    padding: 1rem;
    height: auto;
  }
}

@media (max-width: 480px) {
  #scheduledPostsContainer {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
  
  .scheduled-post-card {
    height: auto;
  }
}

/* CRM Styles */
.crm-tabs {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 20px;
}

.tab-btn {
  padding: 12px 20px;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  font-weight: 500;
  color: #6b7280;
}

.tab-btn.active {
  color: #bfa14a;
  border-bottom-color: #bfa14a;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.crm-section {
  margin-bottom: 30px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.contacts-grid,
.properties-grid,
.transactions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.contact-card,
.property-card,
.transaction-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.contact-header,
.property-header,
.transaction-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.lead-score {
  background: #bfa14a;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.property-price {
  font-weight: 600;
  color: #059669;
}

.transaction-status {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: #dbeafe;
  color: #1d4ed8;
}

.contact-details,
.property-details,
.transaction-details {
  margin-bottom: 12px;
}

.contact-details p,
.property-details p,
.transaction-details p {
  margin: 4px 0;
  font-size: 14px;
}

.contact-actions,
.property-actions,
.transaction-actions {
  display: flex;
  gap: 8px;
}

.btn-small {
  background: #fff !important;
  color: #222 !important;
  border: 1.5px solid #848484 !important;
  box-shadow: none !important;
  border-radius: 6px !important;
  font-weight: 500;
  font-size: 0.75rem;
  padding: 0.35rem 0.8rem;
  transition: background 0.2s, border 0.2s;
  cursor: pointer;
}

.btn-small:hover {
  background: #2e2e2e !important;
  color: #ffffff !important;
  border-color: #959595 !important;
  box-shadow: none !important;
}

.email-campaigns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.campaign-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
}

.campaign-card h4 {
  margin-bottom: 8px;
  color: #374151;
}

.campaign-card p {
  margin-bottom: 16px;
  color: #6b7280;
  font-size: 14px;
}

.form-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  max-width: 500px;
  width: 90%;
}

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

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
  color: #374151;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* === CRM Grid Layout === */
.crm-content {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 20px;
  min-height: calc(100vh - 200px);
  width: 100%;
  padding: 20px;
  position: relative !important;
  contain: layout style;
}

/* Force grid items to stay in place */
.crm-content > * {
  grid-column: 1 / 2;
}

/* Contacts List */
.contacts-section {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  overflow: hidden;
  width: 100%;
  min-width: 0;
  grid-column: 1 / 2;
}

/* Sidebar */
.crm-sidebar {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  padding: 20px;
  border: 1px solid #e1e5e9;
  height: fit-content;
  position: relative;
  width: 100%;
  min-width: 0;
  grid-column: 2 / 3 !important;
  overflow: hidden;
}

.sidebar-section {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid #f1f3f4;
}

.sidebar-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.sidebar-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 15px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-title::before {
  content: '';
  width: 4px;
  height: 16px;
  background: linear-gradient(135deg, #1f1f1e 0%, #1f1f1e 100%);
  border-radius: 2px;
}

.quick-stats {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.stat-card {
  padding: 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-left: 4px solid #1f1f1e;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(191, 161, 74, 0.15);
}

.stat-card-title {
  font-size: 13px;
  color: #666;
  margin-bottom: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card-value {
  font-size: 28px;
  font-weight: bold;
  color: #333;
  background: linear-gradient(135deg, #1f1f1e 0%, #1f1f1e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.recent-activity {
  max-height: 300px;
  overflow-y: auto;
}

.activity-item {
  padding: 10px 0;
  border-bottom: 1px solid #f1f3f4;
  font-size: 14px;
}

.activity-item:last-child {
  border-bottom: none;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .crm-content {
    grid-template-columns: 1fr;
    gap: 15px;
  }
}

@media (max-width: 768px) {
  .crm-content {
    grid-template-columns: 1fr;
    gap: 15px;
  }
}

@media (max-width: 480px) {
  .crm-content {
    grid-template-columns: 1fr;
    gap: 15px;
  }
}