/**
 * EstatixPMS Universal Button System
 * Single Source of Truth based on /docs/btn-format.md
 */

/* ============================================================ */
/* BASE BUTTON STYLING & MICRO-INTERACTIONS                     */
/* ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  vertical-align: middle;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 2rem;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.2px;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 0.2s ease,
    box-shadow 0.25s ease,
    transform 0.15s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    opacity 0.2s ease;
  outline: none;
  line-height: 1;
  text-decoration: none;
  font-family: inherit;
  box-sizing: border-box;
}

/* Tactile micro-animation on active press */
.btn:active:not(:disabled):not(.btn-disabled) {
  transform: scale(0.96);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(30, 43, 60, 0.25);
}

/* Icon centering and uniform sizing */
.btn .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  vertical-align: middle;
}

.btn .icon svg,
.btn > svg {
  width: 0.9rem;
  height: 0.9rem;
  display: block;
  stroke-width: 2;
  flex-shrink: 0;
}

.btn .icon i,
.btn > i {
  font-size: 0.85rem;
  line-height: 1;
  flex-shrink: 0;
}

/* Ensure direct text elements inside .btn stay strictly vertically centered with icon */
.btn > span:not(.icon):not(.badge):not(#notif-badge) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  vertical-align: middle;
}

/* ============================================================ */
/* GENERAL BUTTON VARIANTS (LIGHT THEME DEFAULT)                */
/* ============================================================ */

/* Primary: Main Call-to-Action */
.btn-primary {
  background-color: #1e2b3c;
  border-color: #1e2b3c;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(30, 43, 60, 0.18);
}
.btn-primary:hover:not(:disabled) {
  background-color: #2a3e55;
  border-color: #2a3e55;
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(30, 43, 60, 0.28);
}

/* Secondary: Neutral Actions */
.btn-secondary {
  background-color: #eef2f7;
  border-color: #eef2f7;
  color: #1e2b3c;
  box-shadow: none;
}
.btn-secondary:hover:not(:disabled) {
  background-color: #dde5ee;
  border-color: #dde5ee;
  color: #1e2b3c;
  box-shadow: 0 4px 12px rgba(30, 43, 60, 0.06);
}

/* Outline: Subtle Actions */
.btn-outline {
  background-color: transparent;
  color: #1e2b3c;
  border: 1.5px solid #cdd9e6;
  box-shadow: none;
}
.btn-outline:hover:not(:disabled) {
  background-color: #f6f9fe;
  color: #1e2b3c;
  border-color: #a0b8d0;
  box-shadow: 0 4px 12px rgba(30, 43, 60, 0.05);
}

/* Ghost: Minimal Actions */
.btn-ghost {
  background-color: transparent;
  border-color: transparent;
  color: #3a4e66;
  box-shadow: none;
}
.btn-ghost:hover:not(:disabled) {
  background-color: #eef2f7;
  border-color: #eef2f7;
  color: #1e2b3c;
}

/* ============================================================ */
/* CONTEXTUAL ACTION BUTTONS (LIGHT THEME DEFAULT)              */
/* ============================================================ */

/* Success: Positive outcome */
.btn-success {
  background-color: #0d7a4b;
  border-color: #0d7a4b;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(13, 122, 75, 0.22);
}
.btn-success:hover:not(:disabled) {
  background-color: #0f9059;
  border-color: #0f9059;
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(13, 122, 75, 0.3);
}

/* Warning: Caution / Attention */
.btn-warning {
  background-color: #b45f0a;
  border-color: #b45f0a;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(180, 95, 10, 0.22);
}
.btn-warning:hover:not(:disabled) {
  background-color: #cf6f0e;
  border-color: #cf6f0e;
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(180, 95, 10, 0.3);
}

/* Danger / Error: Destructive actions */
.btn-danger,
.btn-error {
  background-color: #b32b2b;
  border-color: #b32b2b;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(179, 43, 43, 0.22);
}
.btn-danger:hover:not(:disabled),
.btn-error:hover:not(:disabled) {
  background-color: #cc3535;
  border-color: #cc3535;
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(179, 43, 43, 0.3);
}

/* Info: Informational Actions */
.btn-info {
  background-color: #1a6e9e;
  border-color: #1a6e9e;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(26, 110, 158, 0.22);
}
.btn-info:hover:not(:disabled) {
  background-color: #1f80b8;
  border-color: #1f80b8;
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(26, 110, 158, 0.3);
}

/* Soft Action: Inline table row action ("Edit", "Modify") */
.btn-action-soft {
  background-color: #e8edf5;
  border-color: transparent;
  color: #1e3a5f;
  box-shadow: none;
}
.btn-action-soft:hover:not(:disabled) {
  background-color: #d5dfeb;
  border-color: transparent;
  color: #0f253b;
  box-shadow: 0 4px 12px rgba(30, 43, 60, 0.07);
}

/* ============================================================ */
/* SIZE VARIANTS                                                */
/* ============================================================ */

/* Ultra-compact for dense table rows and card action buttons */
.btn-xs {
  padding: 0 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  gap: 0.25rem;
  border-radius: 9999px;
  height: 1.5rem;
  min-height: 1.5rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-xs .icon svg,
.btn-xs > svg {
  width: 0.75rem;
  height: 0.75rem;
  display: block;
  flex-shrink: 0;
}
.btn-xs .icon i,
.btn-xs > i {
  font-size: 0.7rem;
}

/* Small for modal footers, search bars, filter strips */
.btn-sm {
  padding: 0.35rem 0.85rem;
  font-size: 0.78rem;
  gap: 0.35rem;
  border-radius: 1.75rem;
  height: auto;
  min-height: 2rem;
}
.btn-sm .icon svg,
.btn-sm > svg {
  width: 0.8rem;
  height: 0.8rem;
}
.btn-sm .icon i,
.btn-sm > i {
  font-size: 0.78rem;
}

/* Large for hero buttons, banners, onboarding */
.btn-lg {
  padding: 0.75rem 1.8rem;
  font-size: 0.95rem;
  gap: 0.55rem;
  border-radius: 2.5rem;
  height: auto;
  min-height: 2.85rem;
}
.btn-lg .icon svg,
.btn-lg > svg {
  width: 1.1rem;
  height: 1.1rem;
}
.btn-lg .icon i,
.btn-lg > i {
  font-size: 0.95rem;
}

/* Circular and Square Micro-Buttons (Strictly Preserves Topbar Notif Bell & Badges) */
.btn-circle,
.btn.btn-circle {
  border-radius: 9999px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

.btn-square,
.btn.btn-square {
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

/* Explicit protection for notification badge on bell icon */
#notif-badge,
.btn > #notif-badge,
.btn > .badge.absolute {
  position: absolute !important;
  top: 0.25rem !important;
  right: 0.25rem !important;
  z-index: 10 !important;
  pointer-events: none;
}

/* ============================================================ */
/* CELL & LAYOUT UTILITIES                                      */
/* ============================================================ */
.action-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex-wrap: nowrap !important;
  white-space: nowrap !important;
}

/* Icon-only circular buttons inside table action cells */
.action-cell .btn,
.action-cell button {
  width: 1.85rem !important;
  height: 1.85rem !important;
  min-height: 1.85rem !important;
  max-width: 1.85rem !important;
  padding: 0 !important;
  border-radius: 9999px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease !important;
}

.action-cell .btn:hover,
.action-cell button:hover {
  transform: translateY(-1px) scale(1.05) !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.16) !important;
}

.action-cell .btn:active,
.action-cell button:active {
  transform: scale(0.92) !important;
}

.action-cell .btn .icon,
.action-cell button .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.action-cell .btn .icon svg,
.action-cell button .icon svg,
.action-cell .btn > svg,
.action-cell button > svg {
  width: 0.85rem !important;
  height: 0.85rem !important;
  stroke-width: 2.2 !important;
  display: block !important;
}

/* Tooltip precision inside table cells */
.action-cell .tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}
.action-cell .tooltip:before {
  font-size: 0.7rem !important;
  font-weight: 600 !important;
  padding: 0.25rem 0.55rem !important;
  border-radius: 0.5rem !important;
  white-space: nowrap !important;
  z-index: 100 !important;
}

.preview-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* ============================================================ */
/* DARK MODE OVERRIDES ([data-theme="dark"])                    */
/* ============================================================ */
[data-theme="dark"] .btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.35);
}

[data-theme="dark"] .btn-primary {
  background-color: #243b55;
  border-color: #243b55;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .btn-primary:hover:not(:disabled) {
  background-color: #3a5370;
  border-color: #3a5370;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .btn-secondary {
  background-color: #2c3545;
  border-color: #2c3545;
  color: #f1f5f9;
}
[data-theme="dark"] .btn-secondary:hover:not(:disabled) {
  background-color: #3a4659;
  border-color: #3a4659;
  color: #ffffff;
}

[data-theme="dark"] .btn-outline {
  background-color: transparent;
  color: #e2e8f0;
  border: 1.5px solid #425268;
}
[data-theme="dark"] .btn-outline:hover:not(:disabled) {
  background-color: #1e293b;
  border-color: #64748b;
  color: #ffffff;
}

[data-theme="dark"] .btn-ghost {
  background-color: transparent;
  border-color: transparent;
  color: #cbd5e1;
}
[data-theme="dark"] .btn-ghost:hover:not(:disabled) {
  background-color: #2c3545;
  border-color: #2c3545;
  color: #ffffff;
}

[data-theme="dark"] .btn-success {
  background-color: #10b981;
  border-color: #10b981;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .btn-success:hover:not(:disabled) {
  background-color: #059669;
  border-color: #059669;
}

[data-theme="dark"] .btn-warning {
  background-color: #d97706;
  border-color: #d97706;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .btn-warning:hover:not(:disabled) {
  background-color: #b45309;
  border-color: #b45309;
}

[data-theme="dark"] .btn-danger,
[data-theme="dark"] .btn-error {
  background-color: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .btn-danger:hover:not(:disabled),
[data-theme="dark"] .btn-error:hover:not(:disabled) {
  background-color: #dc2626;
  border-color: #dc2626;
}

[data-theme="dark"] .btn-info {
  background-color: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .btn-info:hover:not(:disabled) {
  background-color: #0369a1;
  border-color: #0369a1;
}

[data-theme="dark"] .btn-action-soft {
  background-color: #1e293b;
  border-color: transparent;
  color: #93c5fd;
}
[data-theme="dark"] .btn-action-soft:hover:not(:disabled) {
  background-color: #334155;
  border-color: transparent;
  color: #bfdbfe;
}

/* ============================================================ */
/* RESPONSIVE SCALING                                           */
/* ============================================================ */
@media (max-width: 800px) {
  .btn:not(.btn-circle):not(.btn-square) {
    padding: 0.45rem 0.9rem;
    font-size: 0.78rem;
    line-height: 1;
  }
  .btn-xs:not(.btn-circle):not(.btn-square) {
    padding: 0 0.55rem;
    font-size: 0.7rem;
    height: 1.5rem;
    min-height: 1.5rem;
    line-height: 1;
  }
  .btn-sm:not(.btn-circle):not(.btn-square) {
    padding: 0.35rem 0.8rem;
    font-size: 0.74rem;
    min-height: 2rem;
    line-height: 1;
  }
  .btn-circle,
  .btn.btn-circle {
    padding: 0 !important;
  }
  .btn-square,
  .btn.btn-square {
    padding: 0 !important;
  }
}

/* ============================================================ */
/* ACCESSIBILITY & CONTRAST ENHANCEMENTS (WCAG 2.1 AA)           */
/* ============================================================ */
/* Ensure bright yellow badge warning always has dark, legible text */
.badge.badge-warning:not(.badge-outline) {
  color: #451a03 !important; /* Deep dark amber text yielding > 7:1 contrast ratio against yellow */
}
[data-theme="dark"] .badge.badge-warning:not(.badge-outline) {
  color: #451a03 !important;
}

/* ============================================================ */
/* UNIVERSAL BADGE SAFEGUARDS & OVERLAP PREVENTION              */
/* ============================================================ */
/* Prevent DaisyUI badges with multi-line or wrapped text from collapsing height and overlapping text */
.badge {
  height: auto !important;
  min-height: 1.25rem;
  line-height: 1.25;
  padding-top: 0.15rem;
  padding-bottom: 0.15rem;
  white-space: normal;
  text-align: center;
}
.badge.badge-sm {
  min-height: 1rem;
  line-height: 1.2;
  padding-top: 0.12rem;
  padding-bottom: 0.12rem;
}
.badge.badge-xs {
  min-height: 0.85rem;
  line-height: 1.15;
  padding-top: 0.1rem;
  padding-bottom: 0.1rem;
}

/* Accessible focus visible rings for forms */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--fallback-p,oklch(var(--p)/1)) !important;
  outline-offset: 1px !important;
}

/* ============================================================ */
/* FEED & MODAL CAROUSEL / VIEWER UTILITIES                    */
/* ============================================================ */
.estatix-feed-carousel-viewport {
  position: relative;
  width: 100%;
  height: 280px;
  max-height: 52vh;
  background-color: #000000;
  border-radius: 0.75rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  cursor: pointer;
}
@media (max-width: 640px) {
  .estatix-feed-carousel-viewport {
    height: 240px;
    max-height: 46vh;
  }
}
.estatix-modal-carousel-viewport {
  position: relative;
  width: 100%;
  height: 280px;
  max-height: 40vh;
  background-color: #000000;
  border-radius: 1rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
@media (max-width: 640px) {
  .estatix-modal-carousel-viewport {
    height: 230px;
    max-height: 36vh;
  }
}
.carousel-nav-btn {
  all: unset;
  position: absolute;
  top: 50%;
  transform: translateY(-50%) !important;
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 25;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  transition: background 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.carousel-nav-btn:hover {
  background: rgba(0, 0, 0, 0.85);
  color: #ffffff;
}
.carousel-nav-btn:active {
  transform: translateY(-50%) !important; /* Strict zero scale animation */
  background: rgba(0, 0, 0, 0.95);
}
.carousel-nav-btn:focus {
  outline: none;
}
.carousel-nav-prev {
  left: 12px !important;
  right: auto !important;
}
.carousel-nav-next {
  right: 12px !important;
  left: auto !important;
}

/* Lightbox Modal Dialog & Safe-Area Footer Styling */
#estatix_lightbox_modal::backdrop {
  background: rgba(0, 0, 0, 0.75) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
}
#estatix_lightbox_modal .modal-footer-bar {
  padding-bottom: 36px !important;
  padding-bottom: max(36px, calc(16px + env(safe-area-inset-bottom, 20px))) !important;
}
@media (min-width: 640px) {
  #estatix_lightbox_modal .modal-footer-bar {
    padding-bottom: 16px !important;
  }
}


