/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Custom typography - inline to avoid import issues */

/* Tailwind directives will be processed by the tailwind CLI */
@tailwind base;
@tailwind components;
@tailwind utilities;

/* Action Text / Trix content styles are linked directly in the layouts
   (stylesheet_link_tag "actiontext") — Propshaft doesn't rewrite CSS @imports,
   so an @import here would request an undigested path and 404. */

/* Smooth scrolling behavior */
@layer base {
  html {
    scroll-behavior: smooth;
  }
}

/* Custom components */
@layer components {
  .btn {
    @apply inline-flex items-center justify-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-offset-2;
  }
  .btn-primary {
    @apply bg-primary-600 text-white hover:bg-primary-700 focus:ring-primary-500;
  }
  .btn-secondary {
    @apply bg-secondary-600 text-white hover:bg-secondary-700 focus:ring-secondary-500;
  }
  .btn-accent {
    @apply bg-accent-600 text-white hover:bg-accent-700 focus:ring-accent-500;
  }
  .btn-outline {
    @apply bg-white text-gray-700 border-gray-300 hover:bg-gray-50 focus:ring-gray-500;
  }
  .card {
    @apply bg-white overflow-hidden shadow-sm rounded-lg;
  }
  .card-header {
    @apply px-4 py-5 sm:px-6 bg-gray-50 border-b border-gray-200;
  }
  .card-body {
    @apply px-4 py-5 sm:p-6;
  }
  .card-footer {
    @apply px-4 py-4 sm:px-6 bg-gray-50 border-t border-gray-200;
  }
  .form-input {
    @apply block w-full focus:ring-primary-500 focus:border-primary-500 sm:text-sm border-gray-300 rounded-md;
  }
  .form-label {
    @apply block text-sm font-medium text-gray-700 mb-1;
  }
}

/* topbar (28px sm:36px) + header (64px xl:96px) — keep in sync with layouts/_header.html.erb
   Written as plain CSS (not @apply) because application.css is served unprocessed by
   Propshaft — it is not run through the Tailwind CLI (only application.tailwind.css is),
   so @apply/@layer directives here are inert; see also the .btn/.card/.form-input rules
   above, which are dead for the same reason. */
.below-fixed-header {
  margin-top: 92px;
}
@media (min-width: 640px) {
  .below-fixed-header {
    margin-top: 100px;
  }
}
@media (min-width: 1280px) {
  .below-fixed-header {
    margin-top: 132px;
  }
}

/* Custom utilities */
@layer utilities {
  .text-shadow {
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }
  .text-shadow-md {
    text-shadow: 0 4px 8px rgba(0,0,0,0.12), 0 2px 4px rgba(0,0,0,0.08);
  }
  .text-shadow-lg {
    text-shadow: 0 15px 30px rgba(0,0,0,0.11), 0 5px 15px rgba(0,0,0,0.08);
  }
  .text-shadow-none {
    text-shadow: none;
  }
}

/* Alpine.js cloak - hide elements until Alpine loads */
[x-cloak] { 
  display: none !important; 
}

/* ------------------------------------------------------------------
   Admin sidebar: pinned open vs collapsed icon rail (hover to peek).
   State is server-rendered on <body data-sidebar-collapsed>, toggled by
   the admin-sidebar Stimulus controller.
   ------------------------------------------------------------------ */
@media (min-width: 1024px) {
  #desktop-sidebar {
    transition: width 200ms ease, box-shadow 200ms ease;
  }
  #main-content {
    transition: padding-left 200ms ease;
  }
  #desktop-sidebar .sidebar-toggle-icon {
    transition: transform 200ms ease;
  }

  body[data-sidebar-collapsed="true"] #main-content {
    padding-left: 4rem;
  }
  body[data-sidebar-collapsed="true"] #desktop-sidebar {
    width: 4rem;
  }
  body[data-sidebar-collapsed="true"] #desktop-sidebar .sidebar-toggle-icon {
    transform: rotate(180deg);
  }

  /* Rail (collapsed, not hovered): icons only */
  body[data-sidebar-collapsed="true"] #desktop-sidebar:not(.is-peeking) .sidebar-text,
  body[data-sidebar-collapsed="true"] #desktop-sidebar:not(.is-peeking) .sidebar-logo-text,
  body[data-sidebar-collapsed="true"] #desktop-sidebar:not(.is-peeking) .sidebar-top-toggle {
    display: none;
  }
  body[data-sidebar-collapsed="true"] #desktop-sidebar:not(.is-peeking) .sidebar-header {
    visibility: hidden;
    height: 1px;
    overflow: hidden;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  body[data-sidebar-collapsed="true"] #desktop-sidebar:not(.is-peeking) .admin-sidebar-inner {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    scrollbar-width: none;
  }

  /* Peek: full width as an overlay; page content stays put */
  body[data-sidebar-collapsed="true"] #desktop-sidebar.is-peeking {
    width: 18rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  }

  #desktop-sidebar .sidebar-text {
    white-space: nowrap;
  }
}

/* Admin tours index: inline status picker pill colours */
.tour-status-pill { background-position: right 0.4rem center; }
.tour-status-published   { background-color: #dcfce7; color: #166534; border-color: #86efac; }
.tour-status-maintenance { background-color: #ffedd5; color: #9a3412; border-color: #fdba74; }
.tour-status-draft       { background-color: #f3f4f6; color: #374151; border-color: #d1d5db; }
.tour-status-archived    { background-color: #fef9c3; color: #854d0e; border-color: #fde047; }

/* Live – Under Maintenance tours: slight blur on unconfirmed pricing for visitors */
.pricing-unconfirmed-blur {
  filter: grayscale(1) blur(4px);
}
