/* Auto Post CSE - Front styles - Mobile First Design */
.apcse-root {
  --apcse-primary: var(--e-global-color-primary, #1C2FE3);
  --apcse-secondary: var(--e-global-color-secondary, #B625E8);
  --apcse-text: var(--e-global-color-text, #000000);
  --apcse-accent: var(--e-global-color-accent, #FFFFFF);
  --apcse-radius: 16px;
  --apcse-radius-small: 12px;
  --apcse-radius-large: 24px;
  --apcse-spacing-xs: 0.5rem;
  --apcse-spacing-sm: 1rem;
  --apcse-spacing-md: 1.5rem;
  --apcse-spacing-lg: 2rem;
  --apcse-spacing-xl: 3rem;
  
  font-family: var(--e-global-typography-text-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif);
  color: var(--apcse-text);
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--apcse-spacing-sm);
  line-height: 1.6;
}

/* Mobile first - larger screens */
@media (min-width: 768px) {
  .apcse-root {
    padding: var(--apcse-spacing-md);
  }
}

@media (min-width: 1024px) {
  .apcse-root {
    padding: var(--apcse-spacing-lg);
  }
}

/* Cards - Mobile First */
.apcse-card {
  background: #fff;
  border-radius: var(--apcse-radius);
  padding: var(--apcse-spacing-md);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.06);
  transition: all 0.3s ease;
}

@media (min-width: 768px) {
  .apcse-card {
    padding: var(--apcse-spacing-lg);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
  }
}

/* Tabs - Mobile Optimized */
.apcse-tabs {
  display: flex;
  gap: var(--apcse-spacing-xs);
  margin-bottom: var(--apcse-spacing-md);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 4px;
}

.apcse-tabs::-webkit-scrollbar {
  display: none;
}

.apcse-tab {
  border: 2px solid rgba(0,0,0,.08);
  background: #fff;
  color: var(--apcse-text);
  border-radius: var(--apcse-radius);
  padding: var(--apcse-spacing-xs) var(--apcse-spacing-sm);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 14px;
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.apcse-tab::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.apcse-tab:hover::before {
  left: 100%;
}

.apcse-tab:hover {
  border-color: var(--apcse-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(28,47,227, .15);
}

.apcse-tab.is-active {
  background: var(--apcse-primary);
  color: #fff;
  border-color: var(--apcse-primary);
  box-shadow: 0 6px 20px rgba(28,47,227, .3);
  transform: translateY(-1px);
}

.apcse-tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(28,47,227, .25);
}

/* Larger screens */
@media (min-width: 768px) {
  .apcse-tabs {
    gap: var(--apcse-spacing-sm);
    justify-content: center;
    overflow-x: visible;
  }
  
  .apcse-tab {
    padding: var(--apcse-spacing-sm) var(--apcse-spacing-md);
    font-size: 15px;
  }
}

/* Panels */
.apcse-panel { 
  display: none; 
  animation: fadeIn 0.3s ease-in;
}
.apcse-panel.is-active { 
  display: block; 
}

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

/* Grid system - Mobile First */
.apcse-grid { 
  display: grid; 
  gap: var(--apcse-spacing-sm); 
}

@media (min-width: 640px) {
  .apcse-grid { 
    gap: var(--apcse-spacing-md); 
  }
  .apcse-grid.cols-2 { 
    grid-template-columns: repeat(2, 1fr); 
  }
}

@media (min-width: 768px) {
  .apcse-grid.cols-3 { 
    grid-template-columns: repeat(3, 1fr); 
  }
}

/* Form elements - Mobile Optimized */
.apcse-input, .apcse-select, .apcse-textarea {
  border-radius: var(--apcse-radius);
  border: 2px solid rgba(0,0,0,.08);
  padding: var(--apcse-spacing-sm) var(--apcse-spacing-md);
  font-size: 16px; /* Prevents zoom on iOS */
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
  font-family: inherit;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  -webkit-appearance: none;
  appearance: none;
}

.apcse-input:focus, .apcse-select:focus, .apcse-textarea:focus {
  outline: none;
  border-color: var(--apcse-primary);
  box-shadow: 0 0 0 3px rgba(28,47,227, .1), 0 2px 8px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

.apcse-input::placeholder, .apcse-textarea::placeholder {
  color: #999;
  opacity: 1;
}

/* Textarea specific */
.apcse-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

@media (min-width: 768px) {
  .apcse-input, .apcse-select, .apcse-textarea {
    font-size: 15px;
  }
}

/* Buttons - Mobile Optimized */
.apcse-button {
  border-radius: var(--apcse-radius);
  border: none;
  padding: var(--apcse-spacing-sm) var(--apcse-spacing-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 16px; /* Prevents zoom on iOS */
  font-family: inherit;
  position: relative;
  overflow: hidden;
  min-height: 48px; /* Touch target size */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.apcse-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.apcse-button:active::before {
  left: 100%;
}

.apcse-button:not(.secondary) { 
  background: var(--apcse-primary); 
  color: #fff; 
  box-shadow: 0 2px 8px rgba(28,47,227, .2);
  border-radius: var(--apcse-radius);
}

.apcse-button:not(.secondary):hover {
  background: #1A268F;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(28,47,227, .3);
}

.apcse-button:not(.secondary):active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(28,47,227, .2);
}

.apcse-button.secondary { 
  background: var(--apcse-secondary); 
  color: #fff;
  box-shadow: 0 2px 8px rgba(182,37,232, .2);
  border-radius: var(--apcse-radius);
}

.apcse-button.secondary:hover {
  background: #9c1fd1;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(182,37,232, .3);
}

.apcse-button.secondary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(182,37,232, .2);
}

.apcse-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.apcse-button.small {
  padding: var(--apcse-spacing-xs) var(--apcse-spacing-sm);
  font-size: 14px;
  min-height: 36px;
}

@media (min-width: 768px) {
  .apcse-button {
    font-size: 15px;
    padding: var(--apcse-spacing-sm) var(--apcse-spacing-lg);
  }
}

/* Labels and text */
.apcse-muted { 
  color: #666; 
  font-size: .9rem; 
  margin-bottom: .5rem;
  display: block;
  font-weight: 500;
}

/* Skeleton loading */
.apcse-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Modal styles */
.apcse-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.apcse-modal-content {
  background: white;
  border-radius: var(--apcse-radius);
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Free Plan restrictions */
.is-disabled {
  opacity: .5;
  pointer-events: none;
  filter: grayscale(100%);
  cursor: not-allowed !important;
}

/* Progressive Form Styles */
.apcse-progressive-form {
  position: relative;
}

.apcse-form-step {
  display: none;
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s ease;
  min-height: 300px;
}

.apcse-form-step > div {
  margin-bottom: 1.5rem;
}

.apcse-name-row, .apcse-function-row, .apcse-location-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.apcse-name-row > div, .apcse-function-row > div, .apcse-location-row > div {
  margin-bottom: 0;
}

.apcse-form-step.active {
  display: block;
  opacity: 1;
  transform: translateX(0);
}

.apcse-step-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #f0f0f0;
}

.apcse-step-header h3 {
  color: var(--apcse-primary);
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
}

.apcse-step-header p {
  color: #666;
  font-size: 0.95rem;
  margin: 0;
}

.apcse-form-navigation {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
}

.apcse-progress-bar {
  width: 100%;
  height: 6px;
  background: #f0f0f0;
  border-radius: 3px;
  margin-bottom: 1rem;
  overflow: hidden;
}

.apcse-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--apcse-primary), var(--apcse-secondary));
  border-radius: 3px;
  transition: width 0.3s ease;
}

.apcse-step-counter {
  text-align: center;
  margin-bottom: 1.5rem;
  font-weight: 600;
  color: var(--apcse-primary);
}

.apcse-nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.apcse-nav-buttons button {
  flex: 1;
  max-width: 200px;
}

@media (max-width: 768px) {
  .apcse-nav-buttons {
    flex-direction: column;
  }
  
  .apcse-nav-buttons button {
    max-width: none;
  }
}

/* Post management styles */
.apcse-button.small {
  padding: 6px 10px;
  font-size: 12px;
  min-width: auto;
  opacity: 1 !important;
  visibility: visible !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  background: var(--apcse-secondary);
  color: white;
  border: none;
  border-radius: var(--apcse-radius-small);
  cursor: pointer;
  transition: all 0.2s ease;
}

/* Ensure post action buttons are always visible - FORCE VISIBILITY */
.apcse-post-item .apcse-button.small,
.apcse-card .apcse-button.small,
[style*="background: white"] .apcse-button.small,
[style*="background: white"] .apcse-button {
  opacity: 1 !important;
  visibility: visible !important;
  display: inline-flex !important;
  background: var(--apcse-secondary) !important;
  color: white !important;
  border: none !important;
  padding: 8px 12px !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  text-decoration: none !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: auto !important;
  height: auto !important;
  line-height: 1 !important;
}

/* Hover states for forced buttons */
.apcse-post-item .apcse-button.small:hover,
.apcse-card .apcse-button.small:hover,
[style*="background: white"] .apcse-button.small:hover,
[style*="background: white"] .apcse-button:hover {
  background: #9c1fd1 !important;
  transform: translateY(-1px) !important;
}

/* Primary buttons in modals */
[style*="background: white"] .apcse-button:not(.secondary) {
  background: var(--apcse-primary) !important;
}

[style*="background: white"] .apcse-button:not(.secondary):hover {
  background: #1A268F !important;
}

/* Special style for delete buttons */
.apcse-button.small[style*="color: #d63638"],
[style*="background: white"] .apcse-button.small[style*="color: #d63638"] {
  background: #d63638 !important;
  color: white !important;
}

.apcse-button.small[style*="color: #d63638"]:hover,
[style*="background: white"] .apcse-button.small[style*="color: #d63638"]:hover {
  background: #b32d2e !important;
}

.post-content {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.post-content br {
  line-height: 1.8;
}

/* Ensure buttons are visible in modals - HIGH SPECIFICITY */
div[style*="position: fixed"] .apcse-button.apcse-button,
div[style*="position: fixed"] button.apcse-button.apcse-button,
[style*="position: fixed"] .apcse-button.apcse-button,
[style*="position: fixed"] button.apcse-button.apcse-button {
  opacity: 1 !important;
  visibility: visible !important;
  display: inline-flex !important;
  background: var(--apcse-secondary, #B625E8) !important;
  color: white !important;
  border: none !important;
  border-radius: var(--apcse-radius, 8px) !important;
  padding: 8px 16px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  text-decoration: none !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 36px !important;
  box-shadow: none !important;
  outline: none !important;
  transform: none !important;
  transition: all 0.2s ease !important;
}

/* Small buttons in modals */
div[style*="position: fixed"] .apcse-button.small.apcse-button,
div[style*="position: fixed"] button.apcse-button.small.apcse-button,
[style*="position: fixed"] .apcse-button.small.apcse-button,
[style*="position: fixed"] button.apcse-button.small.apcse-button {
  padding: 6px 10px !important;
  font-size: 12px !important;
  min-height: 32px !important;
}

/* Primary buttons in modals */
div[style*="position: fixed"] .apcse-button:not(.secondary).apcse-button,
div[style*="position: fixed"] button.apcse-button:not(.secondary).apcse-button,
[style*="position: fixed"] .apcse-button:not(.secondary).apcse-button,
[style*="position: fixed"] button.apcse-button:not(.secondary).apcse-button {
  background: var(--apcse-primary, #1C2FE3) !important;
}

/* Hover states */
div[style*="position: fixed"] .apcse-button.apcse-button:hover,
div[style*="position: fixed"] button.apcse-button.apcse-button:hover,
[style*="position: fixed"] .apcse-button.apcse-button:hover,
[style*="position: fixed"] button.apcse-button.apcse-button:hover {
  opacity: 0.9 !important;
  transform: translateY(-1px) !important;
}

/* ULTRA HIGH SPECIFICITY - Override WordPress theme styles */
body div[style*="position: fixed"] div button.apcse-button.apcse-button.apcse-button,
body div[style*="position: fixed"] div .apcse-button.apcse-button.apcse-button,
body [style*="position: fixed"] button.apcse-button.apcse-button.apcse-button,
body [style*="position: fixed"] .apcse-button.apcse-button.apcse-button {
  opacity: 1 !important;
  visibility: visible !important;
  display: inline-flex !important;
  background: var(--apcse-secondary, #B625E8) !important;
  color: white !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 8px 16px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  text-decoration: none !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 36px !important;
  box-shadow: none !important;
  outline: none !important;
  transform: none !important;
  transition: all 0.2s ease !important;
  line-height: normal !important;
  text-align: center !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
  user-select: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
}

/* Override any WordPress button resets */
body div[style*="position: fixed"] button.apcse-button.apcse-button.apcse-button:not(.secondary),
body [style*="position: fixed"] button.apcse-button.apcse-button.apcse-button:not(.secondary) {
  background: var(--apcse-primary, #1C2FE3) !important;
}

/* Small buttons with ultra high specificity */
body div[style*="position: fixed"] button.apcse-button.small.apcse-button.apcse-button,
body [style*="position: fixed"] button.apcse-button.small.apcse-button.apcse-button {
  padding: 6px 10px !important;
  font-size: 12px !important;
  min-height: 32px !important;
}

/* ULTIMATE SPECIFICITY - Using data attribute */
body div[style*="position: fixed"] button[data-apcse-modal-button="true"].apcse-button.apcse-button,
body [style*="position: fixed"] button[data-apcse-modal-button="true"].apcse-button.apcse-button,
body div[style*="position: fixed"] [data-apcse-modal-button="true"].apcse-button.apcse-button,
body [style*="position: fixed"] [data-apcse-modal-button="true"].apcse-button.apcse-button {
  opacity: 1 !important;
  visibility: visible !important;
  display: inline-flex !important;
  background: var(--apcse-secondary, #B625E8) !important;
  color: white !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 8px 16px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  text-decoration: none !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 36px !important;
  box-shadow: none !important;
  outline: none !important;
  transform: none !important;
  transition: all 0.2s ease !important;
  line-height: normal !important;
  text-align: center !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
  user-select: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  position: relative !important;
  overflow: visible !important;
  margin: 0 !important;
  width: auto !important;
  height: auto !important;
}

/* Primary buttons with data attribute */
body div[style*="position: fixed"] button[data-apcse-modal-button="true"].apcse-button:not(.secondary),
body [style*="position: fixed"] button[data-apcse-modal-button="true"].apcse-button:not(.secondary) {
  background: var(--apcse-primary, #1C2FE3) !important;
}

/* Small buttons with data attribute */
body div[style*="position: fixed"] button[data-apcse-modal-button="true"].apcse-button.small,
body [style*="position: fixed"] button[data-apcse-modal-button="true"].apcse-button.small {
  padding: 6px 10px !important;
  font-size: 12px !important;
  min-height: 32px !important;
}

/* FIX BUTTON OVERLAPPING ISSUES */
body div[style*="position: fixed"] .apcse-button,
body [style*="position: fixed"] .apcse-button {
  position: relative !important;
  z-index: 1 !important;
  pointer-events: auto !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
  float: none !important;
  clear: none !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
}

/* Fix button containers */
body div[style*="position: fixed"] div[style*="display: flex"],
body [style*="position: fixed"] div[style*="display: flex"] {
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  flex-wrap: nowrap !important;
  overflow: visible !important;
}

/* Prevent button text selection and interaction issues */
body div[style*="position: fixed"] .apcse-button *,
body [style*="position: fixed"] .apcse-button * {
  pointer-events: none !important;
  user-select: none !important;
}

/* Fix modal content scrolling issues */
body div[style*="position: fixed"] > div {
  overflow-y: auto !important;
  max-height: 80vh !important;
  box-sizing: border-box !important;
}

/* Modal styles */
.apcse-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.apcse-modal-content {
  background: white;
  padding: 30px;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Toast notifications */
.apcse-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  z-index: 10001;
  animation: slideIn 0.3s ease-out;
}

.apcse-toast.success {
  background: #00a32a;
}

.apcse-toast.error {
  background: #d63638;
}

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

/* Filters section */
#apcse-posts-filters {
  background: #f8f9ff;
  border: 1px solid #e1e5f2;
  border-radius: 8px;
  padding: 15px;
}

#apcse-posts-filters .apcse-select,
#apcse-posts-filters .apcse-input {
  margin: 0;
  font-size: 14px;
}

/* Post cards hover effects */
.apcse-card[data-post-id]:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(28, 47, 227, 0.1);
  transition: all 0.2s ease;
}

/* Button hover effects */
.apcse-button.small:hover {
  transform: scale(1.05);
  transition: transform 0.1s ease;
}

/* Responsive design */
@media (max-width: 768px) {
  #apcse-posts-filters > div {
    flex-direction: column;
    gap: 10px;
  }
  
  #apcse-posts-filters > div > div {
    width: 100%;
  }
  
  .apcse-modal-content {
    margin: 20px;
    width: calc(100% - 40px);
  }
  
  .post-content {
    font-size: 13px;
  }
}

/* Result card */
.apcse-result .apcse-card {
  margin-top: 1.5rem;
  border-left: 4px solid var(--apcse-primary);
  background: #f8f9ff;
}

/* Template cards */
.apcse-template-card {
  border: 2px solid rgba(0,0,0,.1);
  border-radius: var(--apcse-radius);
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #fff;
}

.apcse-template-card:hover {
  border-color: var(--apcse-primary);
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0,0,0,.1);
}

.apcse-template-card.selected {
  border-color: var(--apcse-primary);
  background: #f8f9ff;
}

/* Posts list */
.apcse-post-item {
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 20px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  background: #fff;
  transition: all 0.3s ease;
}

.apcse-post-item:hover {
  box-shadow: 0 4px 15px rgba(0,0,0,.1);
  transform: translateY(-2px);
}

/* Calendar */
.apcse-calendar {
  background: #fff;
  border-radius: var(--apcse-radius);
  padding: 1.5rem;
  border: 1px solid rgba(0,0,0,.1);
}

.apcse-calendar-day {
  aspect-ratio: 1;
  border: 1px solid #eee;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.apcse-calendar-day:hover {
  background: #f0f6fc;
}

.apcse-calendar-day.has-event {
  background: var(--apcse-primary);
  color: #fff;
  font-weight: 600;
}

/* Generator Tab - Mobile Optimized */
#apcse-panel-generator .apcse-grid {
  gap: var(--apcse-spacing-md);
}

#apcse-panel-generator .apcse-grid > div {
  display: flex;
  flex-direction: column;
}

#apcse-panel-generator .apcse-muted {
  margin-bottom: var(--apcse-spacing-xs);
  font-weight: 600;
  color: #333;
}

/* Checkbox groups */
.apcse-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--apcse-spacing-sm);
  margin-top: var(--apcse-spacing-xs);
}

.apcse-checkbox-group label {
  display: flex;
  align-items: center;
  gap: var(--apcse-spacing-xs);
  font-size: 14px;
  cursor: pointer;
  padding: var(--apcse-spacing-xs) var(--apcse-spacing-sm);
  border-radius: var(--apcse-radius-small);
  transition: background-color 0.2s ease;
  user-select: none;
}

.apcse-checkbox-group label:hover {
  background-color: rgba(28,47,227, 0.05);
}

.apcse-checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--apcse-primary);
}

/* Posts Tab - Mobile Optimized */
#apcse-posts-filters {
  background: linear-gradient(135deg, #f8f9ff 0%, #f0f6fc 100%);
  border: 1px solid rgba(28,47,227, 0.1);
  border-radius: var(--apcse-radius);
  padding: var(--apcse-spacing-md);
  margin-bottom: var(--apcse-spacing-md);
}

#apcse-posts-filters > div {
  display: flex;
  flex-direction: column;
  gap: var(--apcse-spacing-sm);
}

@media (min-width: 640px) {
  #apcse-posts-filters > div {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }
  
  #apcse-posts-filters > div > div {
    flex: 1;
    min-width: 150px;
  }
}

/* Post Items */
.apcse-post-item {
  border: 1px solid rgba(0,0,0,.06);
  border-radius: var(--apcse-radius);
  padding: var(--apcse-spacing-md);
  margin-bottom: var(--apcse-spacing-sm);
  background: #fff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.apcse-post-item:hover {
  box-shadow: 0 8px 25px rgba(28,47,227, 0.1);
  transform: translateY(-2px);
  border-color: rgba(28,47,227, 0.2);
}

/* Calendar Tab - Mobile Optimized */
#apcse-calendar-container {
  background: #fff;
  border-radius: var(--apcse-radius);
  padding: var(--apcse-spacing-sm);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  overflow-x: auto;
}

.calendar-day {
  padding: var(--apcse-spacing-xs);
  background: white;
  min-height: 50px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: var(--apcse-radius-small);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.calendar-day:hover {
  background: #f0f6fc;
  transform: scale(1.02);
}

.calendar-day.has-posts {
  background: linear-gradient(135deg, var(--apcse-primary), #1A268F);
  color: white;
  font-weight: 600;
}

@media (min-width: 768px) {
  .calendar-day {
    min-height: 80px;
    font-size: 16px;
  }
}

/* Profile Tab - Mobile Optimized */
#apcse-panel-profile {
  text-align: center;
}

#apcse-panel-profile h3 {
  color: var(--apcse-primary);
  margin-bottom: var(--apcse-spacing-md);
}

/* Empty States */
.apcse-empty-state {
  text-align: center;
  padding: var(--apcse-spacing-xl);
  color: #666;
}

.apcse-empty-state .emoji {
  font-size: 48px;
  margin-bottom: var(--apcse-spacing-md);
  opacity: 0.6;
}

.apcse-empty-state h3 {
  color: #666;
  margin-bottom: var(--apcse-spacing-sm);
  font-size: 18px;
}

.apcse-empty-state p {
  color: #999;
  font-size: 14px;
}

@media (min-width: 768px) {
  .apcse-empty-state {
    padding: var(--apcse-spacing-xl) var(--apcse-spacing-lg);
  }
  
  .apcse-empty-state .emoji {
    font-size: 64px;
  }
  
  .apcse-empty-state h3 {
    font-size: 20px;
  }
  
  .apcse-empty-state p {
    font-size: 16px;
  }
}

/* Utility classes */
.apcse-text-center { text-align: center; }
.apcse-text-muted { color: #666; }
.apcse-mb-1 { margin-bottom: 1rem; }
.apcse-mt-1 { margin-top: 1rem; }
.apcse-hidden { display: none; }

/* Toast notifications */
.apcse-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--apcse-primary);
  color: #fff;
  padding: 1rem 1.5rem;
  border-radius: var(--apcse-radius);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

.apcse-toast.error {
  background: #d63638;
}

.apcse-toast.success {
  background: #00a32a;
}

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

/* Authentication Forms - Mobile First */
.apcse-auth-container {
  max-width: 400px;
  margin: 0 auto;
  padding: var(--apcse-spacing-sm);
}

@media (min-width: 640px) {
  .apcse-auth-container {
    max-width: 500px;
    padding: var(--apcse-spacing-md);
  }
}

/* Auth tabs specific styling */
[data-apcse-auth] .apcse-tabs {
  margin-bottom: var(--apcse-spacing-lg);
  justify-content: center;
}

[data-apcse-auth] .apcse-tab {
  flex: 1;
  text-align: center;
  min-width: 120px;
}

@media (min-width: 480px) {
  [data-apcse-auth] .apcse-tab {
    flex: none;
    min-width: 140px;
  }
}

/* Auth form styling */
.apcse-auth-form {
  display: grid;
  gap: var(--apcse-spacing-md);
}

.apcse-auth-form .apcse-input {
  background: #fafafa;
  border: 2px solid rgba(0,0,0,0.06);
  transition: all 0.3s ease;
}

.apcse-auth-form .apcse-input:focus {
  background: #fff;
  border-color: var(--apcse-primary);
  box-shadow: 0 0 0 3px rgba(28,47,227, .1), 0 4px 12px rgba(0,0,0,0.1);
}

/* Password toggle button */
.password-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: #666;
  transition: color 0.2s ease;
  padding: 0;
  min-width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-toggle:hover {
  color: var(--apcse-primary);
}

/* Form validation messages */
.apcse-validation-message {
  font-size: 13px;
  margin-top: var(--apcse-spacing-xs);
  padding: var(--apcse-spacing-xs) var(--apcse-spacing-sm);
  border-radius: var(--apcse-radius-small);
  display: none;
}

.apcse-validation-message.success {
  color: #00a32a;
  background: rgba(0, 163, 42, 0.1);
  border: 1px solid rgba(0, 163, 42, 0.2);
}

.apcse-validation-message.error {
  color: #d63638;
  background: rgba(214, 54, 56, 0.1);
  border: 1px solid rgba(214, 54, 56, 0.2);
}

/* Two-column layout for name fields */
.apcse-name-row,
.apcse-function-row,
.apcse-location-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Email validation styles */
#email-validation {
  font-size: 12px;
  margin-top: 5px;
  padding: 5px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
}

/* Profile form improvements */
.apcse-grid.cols-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 768px) {
  .apcse-grid.cols-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .apcse-name-row,
  .apcse-function-row {
    grid-template-columns: 1fr;
    gap: var(--apcse-spacing-sm);
  }
}

/* Notices styling */
.notice {
  padding: var(--apcse-spacing-md);
  border-radius: var(--apcse-radius);
  margin-bottom: var(--apcse-spacing-md);
  border-left: 4px solid;
}

.notice.notice-success {
  background: rgba(0, 163, 42, 0.1);
  border-left-color: #00a32a;
  color: #00a32a;
}

.notice.notice-error {
  background: rgba(214, 54, 56, 0.1);
  border-left-color: #d63638;
  color: #d63638;
}

.notice ul {
  margin: 0;
  padding-left: var(--apcse-spacing-md);
}

.notice li {
  margin-bottom: var(--apcse-spacing-xs);
}

/* Loading states */
.apcse-loading {
  position: relative;
  overflow: hidden;
}

.apcse-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: loading-sweep 1.5s infinite;
}

@keyframes loading-sweep {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Responsive improvements */
@media (max-width: 640px) {
  .apcse-root {
    padding: var(--apcse-spacing-xs);
  }
  
  .apcse-card {
    padding: var(--apcse-spacing-md);
    border-radius: var(--apcse-radius-small);
  }
  
  .apcse-button {
    width: 100%;
    justify-content: center;
  }
  
  .apcse-tabs {
    gap: var(--apcse-spacing-xs);
  }
  
  .apcse-tab {
    font-size: 14px;
    padding: var(--apcse-spacing-xs) var(--apcse-spacing-sm);
  }
}

/* Modal styles - ensure buttons are always visible but keep normal styling */
[style*="position: fixed"] {
  z-index: 10000 !important;
}

[style*="position: fixed"] .apcse-button {
  opacity: 1 !important;
  visibility: visible !important;
  display: inline-flex !important;
  /* Ensure normal button styles are preserved */
  border-radius: var(--apcse-radius);
  border: none;
  padding: var(--apcse-spacing-sm) var(--apcse-spacing-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 16px;
  font-family: inherit;
  position: relative;
  overflow: hidden;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  user-select: none;
}

[style*="position: fixed"] .apcse-button:not(.secondary) {
  background: var(--apcse-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(28,47,227, .2);
}

[style*="position: fixed"] .apcse-button.secondary {
  background: var(--apcse-secondary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(182,37,232, .2);
}

[style*="position: fixed"] .apcse-button:not(.secondary):hover {
  background: #1A268F;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(28,47,227, .3);
}

[style*="position: fixed"] .apcse-button.secondary:hover {
  background: #9c1fd1;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(182,37,232, .3);
}

/* Small buttons in modals */
[style*="position: fixed"] .apcse-button.small {
  padding: 6px 10px;
  font-size: 12px;
  min-width: auto;
  min-height: 36px;
}

/* Modal content styling */
[style*="position: fixed"] [style*="background: white"] {
  box-shadow: 0 20px 60px rgba(0,0,0,0.3) !important;
  border-radius: 16px !important;
}

/* Touch improvements */
@media (hover: none) and (pointer: coarse) {
  .apcse-button:hover {
    transform: none;
  }
  
  .apcse-tab:hover {
    transform: none;
  }
  
  .apcse-post-item:hover {
    transform: none;
  }
  
  .calendar-day:hover {
    transform: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .apcse-input, .apcse-select, .apcse-textarea {
    border-width: 3px;
  }
  
  .apcse-button {
    border: 2px solid currentColor;
  }
  
  .apcse-tab {
    border-width: 3px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .apcse-button:hover,
  .apcse-tab:hover,
  .apcse-post-item:hover {
    transform: none;
  }
}
