/**
 *
 * (c) Copyright Ascensio System SIA 2021
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

/* Global anti-overflow rule (safety) */
* {
    box-sizing: border-box;
}

img, video, iframe {
    max-width: 100%;
}

/* ============================================
   Swiper — onboarding (pagination bullets only; base CSS from application.tailwind.css)
   ============================================ */

.onboarding-carousel.swiper {
  width: 100%;
  height: 100%;
}

.onboarding-dots.swiper-pagination {
  position: relative;
  bottom: auto;
  left: auto;
  margin-top: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 20px 0 0;
}

.onboarding-dots .swiper-pagination-bullet {
  width: 10px;
  height: 10px;
  margin: 0 !important;
  opacity: 1;
  background: transparent;
  border: 1px solid rgba(2, 132, 199, 0.3);
  border-radius: 9999px;
  transition: background 0.3s, border-color 0.3s;
}

.onboarding-dots .swiper-pagination-bullet-active {
  background: rgb(2, 132, 199);
  border-color: rgb(2, 132, 199);
}

.dark .onboarding-dots .swiper-pagination-bullet {
  border-color: rgba(255, 255, 255, 0.3);
}

.dark .onboarding-dots .swiper-pagination-bullet-active {
  background: white;
  border-color: white;
}

/* ============================================
   Flip styles
   ============================================ */

.wrap {
  perspective: 1000px;
  position: relative;
  min-height: 300px;
}

.card {
  height: auto;
  transform-style: preserve-3d;
  transition: transform 600ms cubic-bezier(.2, .8, .2, 1);
}

.card.is-flipped {
  transform: rotateY(180deg);
}

.side {
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden; /* Safari */
}

.side.front {
  position: relative;
}

.side.back {
  transform: rotateY(180deg);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  min-height: 100%;
}

/* When card is not flipped, show front normally and hide back */
.card:not(.is-flipped) .side.back {
  visibility: hidden;
  pointer-events: none;
}

/* When card is flipped, hide front and show back */
.card.is-flipped .side.front {
  visibility: hidden;
  pointer-events: none;
}

.card.is-flipped .side.back {
  visibility: visible;
  pointer-events: auto;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .card {
    transition: none;
  }
  .side {
    transform: none !important;
  }
  .card:not(.is-flipped) .back {
    display: none;
  }
  .card.is-flipped .front {
    display: none;
  }
}

/* ============================================
   User Card Front
   ============================================ */

.bg-card-light .drawer-wrapper {
  display: none;
}

/* ============================================
   Dropdown
   ============================================ */

[data-dropdown-target="menu"] {
    position: fixed;   /* 🔑 avoids clipping in WebView */
}

.dropdown--open [data-dropdown-target="menu"] {
    display: block;
}

/* ============================================
   Custom styles
   ============================================ */

.button_to{
  width: -webkit-fill-available;
  width: -moz-available;
  width: stretch;
}

turbo-cable-stream-source {
  display: none !important;
}

/* Force width for iOS / WebView */
.w-fill-available {
  width: -webkit-fill-available;
  width: -moz-available;
  width: stretch;
}

/* Hide scrollbar but keep scroll */
.scrollbar-hide {
  -ms-overflow-style: none;      /* IE / Edge */
  scrollbar-width: none;         /* Firefox */
}
.scrollbar-hide::-webkit-scrollbar {
  display: none;                 /* Chrome / Safari */
}

/* ============================================
   Feeds index page
 ── Masonry feed layout ─────────────────────────────────────────────────────
   Uses CSS columns for a Pinterest-style masonry.  Each direct child of
   #user_feeds (turbo-frame during lazy-load, or the bare post/event div
   after turbo_stream.replace) must not break across columns.
   The parent infinite-scroll wrapper has overflow-x-auto for other views;
   override it here so the feed only scrolls vertically.
  ============================================ */
#user_feeds {
    overflow-x: hidden;
}

#user_feeds > * {
    break-inside: avoid;
    margin-bottom: 1rem;
}
