/* CodeX Media — reusable component library. Consumed by every public and admin view. */

/* ---------------------------------------------------------------- */
/* Hero media — image + overlapping floating badge, ties a section's  */
/* illustration to its text instead of leaving the image isolated.   */
/* ---------------------------------------------------------------- */
.cx-hero-media {
  position: relative;
  isolation: isolate;
}

.cx-hero-media__frame {
  position: relative;
  border-radius: var(--cx-radius-lg);
  overflow: hidden;
  box-shadow: var(--cx-shadow-lg);
}

.cx-hero-media__frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(200deg, transparent 55%, rgba(16, 17, 20, 0.14) 100%);
  pointer-events: none;
}

.cx-hero-media__frame img {
  display: block;
  width: 100%;
  height: auto;
}

.cx-hero-badge {
  position: absolute;
  bottom: calc(-1 * var(--cx-space-24));
  inset-inline-start: calc(-1 * var(--cx-space-24));
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--cx-space-12);
  max-width: 240px;
  background: var(--cx-glass-bg);
  backdrop-filter: blur(var(--cx-glass-blur));
  -webkit-backdrop-filter: blur(var(--cx-glass-blur));
  border: 1px solid var(--cx-glass-border);
  border-radius: var(--cx-radius-md);
  box-shadow: var(--cx-shadow-lg);
  padding: var(--cx-space-16);
}

.cx-hero-badge__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--cx-radius-sm);
  background: var(--cx-gradient-primary);
  color: #fff;
}

.cx-hero-badge__title {
  display: block;
  font-size: var(--cx-fs-sm);
  font-weight: 700;
  color: var(--cx-text);
  line-height: var(--cx-lh-tight);
}

.cx-hero-badge__desc {
  display: block;
  font-size: var(--cx-fs-xs);
  color: var(--cx-secondary-text);
  line-height: var(--cx-lh-tight);
  margin-top: 2px;
}

@media (max-width: 767.98px) {
  .cx-hero-badge {
    max-width: calc(100% - var(--cx-space-32));
    inset-inline-start: var(--cx-space-16);
    bottom: calc(-1 * var(--cx-space-16));
    padding: var(--cx-space-12);
  }
}

/* ---------------------------------------------------------------- */
/* Buttons                                                           */
/* ---------------------------------------------------------------- */
.btn-cx {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--cx-space-8);
  min-height: var(--cx-touch-target);
  padding: 0.75rem 1.5rem;
  border-radius: var(--cx-radius-pill);
  font-weight: 600;
  font-size: var(--cx-fs-sm);
  border: 1px solid transparent;
  transition: transform var(--cx-duration-base) var(--cx-ease), box-shadow var(--cx-duration-base) var(--cx-ease), background var(--cx-duration-base) var(--cx-ease);
  cursor: pointer;
}

.btn-cx:active {
  transform: translateY(1px);
}

.btn-cx-primary {
  background: var(--cx-gradient-primary);
  color: #fff;
  box-shadow: var(--cx-shadow-md);
}

.btn-cx-primary:hover {
  color: #fff;
  box-shadow: var(--cx-shadow-lg);
}

.btn-cx-outline {
  background: var(--cx-surface);
  color: var(--cx-primary);
  border-color: var(--cx-border);
}

.btn-cx-outline:hover {
  color: var(--cx-primary);
  border-color: var(--cx-primary);
  box-shadow: var(--cx-shadow-sm);
}

.btn-cx-whatsapp {
  background: #25D366;
  color: #fff;
}

.btn-cx-whatsapp:hover {
  color: #fff;
  filter: brightness(1.05);
  box-shadow: var(--cx-shadow-md);
}

.btn-cx-sm {
  min-height: 36px;
  padding: 0.5rem 1rem;
  font-size: var(--cx-fs-xs);
}

/* ---------------------------------------------------------------- */
/* Header + mobile navigation                                       */
/* ---------------------------------------------------------------- */
.cx-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: var(--cx-glass-bg);
  backdrop-filter: blur(var(--cx-glass-blur));
  -webkit-backdrop-filter: blur(var(--cx-glass-blur));
  border-bottom: 1px solid var(--cx-border);
}

.cx-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--cx-header-height);
  gap: var(--cx-space-16);
}

.cx-header__logo img {
  height: 36px;
  width: auto;
}

.cx-header__nav {
  display: none;
}

@media (min-width: 992px) {
  .cx-header__nav {
    display: flex;
    align-items: center;
    gap: var(--cx-space-24);
  }
}

.cx-header__nav a {
  color: var(--cx-text);
  font-weight: 500;
  font-size: var(--cx-fs-sm);
}

.cx-header__nav a:hover,
.cx-header__nav a.active {
  color: var(--cx-primary);
}

.cx-header__actions {
  display: flex;
  align-items: center;
  gap: var(--cx-space-12);
}

.cx-nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--cx-touch-target);
  height: var(--cx-touch-target);
  border-radius: var(--cx-radius-sm);
  border: 1px solid var(--cx-border);
  background: var(--cx-surface);
}

@media (min-width: 992px) {
  .cx-nav-toggle {
    display: none;
  }
}

.cx-mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: var(--cx-surface);
  transform: translateX(100%);
  transition: transform var(--cx-duration-base) var(--cx-ease);
  overflow-y: auto;
  padding: var(--cx-space-24);
}

html[dir="rtl"] .cx-mobile-nav {
  transform: translateX(-100%);
}

/* Keep specificity >= the RTL rule above so the drawer actually opens in both
   directions — a bare `.cx-mobile-nav.is-open` loses to `html[dir=rtl] .cx-mobile-nav`. */
.cx-mobile-nav.is-open,
html[dir="rtl"] .cx-mobile-nav.is-open,
html[dir="ltr"] .cx-mobile-nav.is-open {
  transform: translateX(0);
}

.cx-mobile-nav__list {
  list-style: none;
  padding: 0;
  margin: var(--cx-space-32) 0 0;
  display: flex;
  flex-direction: column;
  gap: var(--cx-space-8);
}

.cx-mobile-nav__list a {
  display: block;
  min-height: var(--cx-touch-target);
  display: flex;
  align-items: center;
  padding: var(--cx-space-12) var(--cx-space-8);
  font-size: var(--cx-fs-md);
  font-weight: 600;
  color: var(--cx-text);
  border-bottom: 1px solid var(--cx-border);
}

/* ---------------------------------------------------------------- */
/* Language switcher                                                 */
/* ---------------------------------------------------------------- */
.cx-lang-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--cx-border);
  border-radius: var(--cx-radius-pill);
  background: var(--cx-surface);
  padding: 0.25rem;
  gap: 0.125rem;
}

.cx-lang-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 36px;
  border-radius: var(--cx-radius-pill);
  font-size: var(--cx-fs-xs);
  font-weight: 700;
  color: var(--cx-secondary-text);
}

.cx-lang-switch a.active {
  background: var(--cx-gradient-primary);
  color: #fff;
}

/* ---------------------------------------------------------------- */
/* Cards                                                              */
/* ---------------------------------------------------------------- */
.cx-card {
  background: var(--cx-surface);
  border: 1px solid var(--cx-border);
  border-radius: var(--cx-radius-lg);
  box-shadow: var(--cx-shadow-sm);
  transition: transform var(--cx-duration-base) var(--cx-ease), box-shadow var(--cx-duration-base) var(--cx-ease);
  height: 100%;
}

.cx-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--cx-shadow-lg);
}

.cx-card__body {
  padding: var(--cx-space-24);
}

.cx-card__icon {
  width: 56px;
  height: 56px;
  border-radius: var(--cx-radius-md);
  background: var(--cx-lavender);
  color: var(--cx-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: var(--cx-space-16);
}

.cx-card__media {
  border-radius: var(--cx-radius-lg) var(--cx-radius-lg) 0 0;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--cx-lavender);
}

.cx-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Package grid — keeps every card the same height so the CTAs line up */
.cx-package-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  column-gap: var(--cx-space-24);
  row-gap: var(--cx-space-16);
}

@media (min-width: 768px) {
  .cx-package-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 992px) {
  .cx-package-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Package card */
.cx-package {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--cx-space-32) var(--cx-space-24);
  text-align: start;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.cx-package:hover {
  transform: translateY(-4px);
  box-shadow: var(--cx-shadow-lg);
}

.cx-package--featured {
  border-color: var(--cx-primary);
  box-shadow: var(--cx-shadow-lg);
}

.cx-package__name {
  font-size: var(--cx-fs-lg);
  font-weight: 700;
  margin: 0;
}

/* Empty slots exist only to keep the subgrid rows aligned across cards */
.cx-package__slot--empty {
  display: none;
}

/* Subgrid: every card shares the same row track heights, so the price,
   features, note and button of each card sit on identical baselines. */
@supports (grid-template-rows: subgrid) {
  .cx-package-grid > .cx-package {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 6;
    height: auto;
  }

  .cx-package-grid > .cx-package > * {
    margin: 0;
  }

  .cx-package-grid > .cx-package .cx-package__slot--empty {
    display: block;
    min-height: 0;
  }

  .cx-package-grid > .cx-package .cx-package__features {
    margin: 0;
  }
}

.cx-package__badge {
  position: absolute;
  top: -14px;
  inset-inline-start: var(--cx-space-24);
  background: var(--cx-gradient-primary);
  color: #fff;
  font-size: var(--cx-fs-xs);
  font-weight: 700;
  padding: 0.35rem 0.9rem;
  border-radius: var(--cx-radius-pill);
}

.cx-package__price {
  font-size: var(--cx-fs-2xl);
  font-weight: 800;
  color: var(--cx-text);
}

.cx-package__price {
  line-height: 1.2;
}

.cx-package__price small {
  display: block;
  margin-top: var(--cx-space-4, 0.25rem);
  font-size: var(--cx-fs-sm);
  font-weight: 500;
  color: var(--cx-secondary-text);
}

.cx-package__delivery {
  font-size: var(--cx-fs-xs);
  color: var(--cx-secondary-text);
  margin: var(--cx-space-8) 0 0;
}

.cx-package__features {
  list-style: none;
  padding: 0;
  margin: var(--cx-space-24) 0;
  display: flex;
  flex-direction: column;
  gap: var(--cx-space-12);
  flex: 1 1 auto;
}

.cx-package__note-slot {
  margin-top: var(--cx-space-8);
}

.cx-package__cta {
  margin-top: auto;
  padding-top: var(--cx-space-16);
}

.cx-package__features li {
  display: flex;
  align-items: flex-start;
  gap: var(--cx-space-8);
  font-size: var(--cx-fs-sm);
  color: var(--cx-secondary-text);
}

.cx-package__features li::before {
  content: "";
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--cx-lavender);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23356DFF' stroke-width='2'%3E%3Cpath d='M3 8.5l3 3 7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 10px;
}

.cx-package__note {
  margin: 0;
  font-size: var(--cx-fs-xs);
  color: var(--cx-secondary-text);
  background: var(--cx-background);
  border: 1px dashed var(--cx-border);
  border-radius: var(--cx-radius-sm);
  padding: var(--cx-space-12);
}

/* ---------------------------------------------------------------- */
/* CTA sections                                                      */
/* ---------------------------------------------------------------- */
.cx-cta {
  position: relative;
  overflow: hidden;
  border-radius: var(--cx-radius-lg);
  background: var(--cx-gradient-primary);
  color: #fff;
  padding: var(--cx-space-48) var(--cx-space-24);
  text-align: center;
}

.cx-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("../images/brand-pattern.png");
  background-size: cover;
  background-position: center;
  opacity: 0.18;
  mix-blend-mode: overlay;
  pointer-events: none;
}

.cx-cta > * {
  position: relative;
  z-index: 1;
}

.cx-cta h2 {
  color: #fff;
}

.cx-cta p {
  color: rgba(255, 255, 255, 0.85);
}

/* ---------------------------------------------------------------- */
/* Footer                                                             */
/* ---------------------------------------------------------------- */
.cx-footer {
  background: var(--cx-text);
  color: rgba(255, 255, 255, 0.75);
  padding-block: var(--cx-space-64) var(--cx-space-32);
}

.cx-footer a {
  color: rgba(255, 255, 255, 0.8);
}

.cx-footer a:hover {
  color: #fff;
}

.cx-footer h6 {
  color: #fff;
  font-size: var(--cx-fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--cx-space-16);
}

.cx-footer__bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin-top: var(--cx-space-48);
  padding-top: var(--cx-space-24);
  font-size: var(--cx-fs-xs);
  color: rgba(255, 255, 255, 0.55);
}

/* ---------------------------------------------------------------- */
/* Floating WhatsApp button                                          */
/* ---------------------------------------------------------------- */
.cx-whatsapp-float {
  position: fixed;
  bottom: var(--cx-space-24);
  inset-inline-end: var(--cx-space-24);
  z-index: 1040;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #25D366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--cx-shadow-lg);
  transition: transform var(--cx-duration-base) var(--cx-ease);
}

.cx-whatsapp-float:hover {
  transform: scale(1.08);
  color: #fff;
}

.cx-whatsapp-float svg {
  width: 30px;
  height: 30px;
}

/* ---------------------------------------------------------------- */
/* Alerts                                                             */
/* ---------------------------------------------------------------- */
.cx-alert {
  border-radius: var(--cx-radius-md);
  padding: var(--cx-space-16) var(--cx-space-24);
  border: 1px solid var(--cx-border);
  font-size: var(--cx-fs-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--cx-space-12);
}

.cx-alert-success {
  background: #EAF7F1;
  border-color: #BFE8D6;
  color: var(--cx-success);
}

.cx-alert-danger {
  background: #FBEAE7;
  border-color: #F3C6BD;
  color: var(--cx-danger);
}

.cx-alert-info {
  background: var(--cx-lavender);
  border-color: #DCD2FA;
  color: var(--cx-purple);
}

/* ---------------------------------------------------------------- */
/* Pagination                                                         */
/* ---------------------------------------------------------------- */
.cx-pagination {
  display: flex;
  justify-content: center;
  gap: var(--cx-space-8);
  list-style: none;
  padding: 0;
  margin: var(--cx-space-32) 0 0;
}

.cx-pagination a,
.cx-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--cx-touch-target);
  min-height: var(--cx-touch-target);
  border-radius: var(--cx-radius-sm);
  border: 1px solid var(--cx-border);
  color: var(--cx-text);
  font-size: var(--cx-fs-sm);
}

.cx-pagination a:hover {
  border-color: var(--cx-primary);
  color: var(--cx-primary);
}

.cx-pagination .active span {
  background: var(--cx-gradient-primary);
  border-color: transparent;
  color: #fff;
}

/* ---------------------------------------------------------------- */
/* Forms (public + admin share the same base)                        */
/* ---------------------------------------------------------------- */
.cx-form-label {
  font-weight: 600;
  font-size: var(--cx-fs-sm);
  color: var(--cx-text);
  margin-bottom: var(--cx-space-8);
}

.cx-form-control {
  width: 100%;
  min-height: var(--cx-touch-target);
  border: 1px solid var(--cx-border);
  border-radius: var(--cx-radius-sm);
  padding: 0.65rem 1rem;
  font-size: var(--cx-fs-sm);
  background: var(--cx-surface);
  color: var(--cx-text);
  transition: border-color var(--cx-duration-fast) var(--cx-ease), box-shadow var(--cx-duration-fast) var(--cx-ease);
}

.cx-form-control:focus {
  border-color: var(--cx-primary);
  box-shadow: 0 0 0 4px rgba(53, 109, 255, 0.12);
  outline: none;
}

textarea.cx-form-control {
  min-height: 120px;
  resize: vertical;
}

.cx-form-error {
  color: var(--cx-danger);
  font-size: var(--cx-fs-xs);
  margin-top: var(--cx-space-4);
}

.cx-form-hint {
  color: var(--cx-secondary-text);
  font-size: var(--cx-fs-xs);
  margin-top: var(--cx-space-4);
}

/* Quote request form card */
.cx-quote-form {
  background: var(--cx-surface);
  border: 1px solid var(--cx-border);
  border-radius: var(--cx-radius-lg);
  box-shadow: var(--cx-shadow-md);
  padding: var(--cx-space-32);
}

/* ---------------------------------------------------------------- */
/* Rich-text article body (sanitized admin content)                  */
/* ---------------------------------------------------------------- */
.cx-article-body h2 {
  font-size: var(--cx-fs-xl);
  margin-top: var(--cx-space-32);
  margin-bottom: var(--cx-space-12);
  scroll-margin-top: calc(var(--cx-header-height) + var(--cx-space-16));
}

.cx-article-body h3 {
  font-size: var(--cx-fs-lg);
  margin-top: var(--cx-space-24);
  margin-bottom: var(--cx-space-8);
  scroll-margin-top: calc(var(--cx-header-height) + var(--cx-space-16));
}

.cx-article-body p {
  margin-bottom: var(--cx-space-16);
  line-height: var(--cx-lh-relaxed);
}

.cx-article-body ul,
.cx-article-body ol {
  margin-bottom: var(--cx-space-16);
  padding-inline-start: 1.5rem;
}

.cx-article-body blockquote {
  border-inline-start: 3px solid var(--cx-primary);
  padding-inline-start: var(--cx-space-16);
  color: var(--cx-secondary-text);
  font-style: italic;
  margin: var(--cx-space-16) 0;
}

.cx-article-body img {
  border-radius: var(--cx-radius-md);
  margin-block: var(--cx-space-16);
}

.cx-article-body a {
  text-decoration: underline;
}

/* ---------------------------------------------------------------- */
/* Admin shell                                                        */
/* ---------------------------------------------------------------- */
.cx-admin-sidebar {
  background: var(--cx-surface);
  border-inline-end: 1px solid var(--cx-border);
  min-height: 100vh;
}

.cx-admin-sidebar a {
  display: flex;
  align-items: center;
  gap: var(--cx-space-12);
  padding: 0.75rem var(--cx-space-16);
  border-radius: var(--cx-radius-sm);
  color: var(--cx-secondary-text);
  font-weight: 500;
  font-size: var(--cx-fs-sm);
  min-height: var(--cx-touch-target);
}

.cx-admin-sidebar a:hover,
.cx-admin-sidebar a.active {
  background: var(--cx-lavender);
  color: var(--cx-primary);
}

.cx-admin-topbar {
  background: var(--cx-surface);
  border-bottom: 1px solid var(--cx-border);
  min-height: 64px;
  display: flex;
  align-items: center;
}

.cx-admin-card {
  background: var(--cx-surface);
  border: 1px solid var(--cx-border);
  border-radius: var(--cx-radius-md);
  box-shadow: var(--cx-shadow-sm);
  padding: var(--cx-space-24);
}

/* Admin tables — responsive scroll wrapper, never overflow the page */
.cx-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--cx-border);
  border-radius: var(--cx-radius-md);
  background: var(--cx-surface);
}

.cx-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.cx-table th,
.cx-table td {
  padding: var(--cx-space-12) var(--cx-space-16);
  text-align: start;
  font-size: var(--cx-fs-sm);
  border-bottom: 1px solid var(--cx-border);
  white-space: nowrap;
}

.cx-table th {
  color: var(--cx-secondary-text);
  font-weight: 600;
  background: var(--cx-background);
}

.cx-table tbody tr:hover {
  background: var(--cx-background);
}

.cx-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: var(--cx-radius-pill);
  font-size: var(--cx-fs-xs);
  font-weight: 600;
}

.cx-badge-published { background: #EAF7F1; color: var(--cx-success); }
.cx-badge-draft { background: #FBF3E4; color: var(--cx-warning); }
.cx-badge-featured { background: var(--cx-lavender); color: var(--cx-purple); }

/* Confirmation modals */
.cx-modal .modal-content {
  border-radius: var(--cx-radius-lg);
  border: 1px solid var(--cx-border);
  box-shadow: var(--cx-shadow-lg);
}

/* Image uploader */
.cx-uploader {
  border: 2px dashed var(--cx-border);
  border-radius: var(--cx-radius-md);
  padding: var(--cx-space-32);
  text-align: center;
  background: var(--cx-background);
  cursor: pointer;
  transition: border-color var(--cx-duration-fast) var(--cx-ease), background var(--cx-duration-fast) var(--cx-ease);
}

.cx-uploader:hover,
.cx-uploader.is-dragover {
  border-color: var(--cx-primary);
  background: var(--cx-lavender);
}

.cx-uploader__preview {
  display: flex;
  flex-wrap: wrap;
  gap: var(--cx-space-12);
  margin-top: var(--cx-space-16);
}

.cx-uploader__preview img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: var(--cx-radius-sm);
  border: 1px solid var(--cx-border);
}
