/*
 * Botym iOS16 Custom Styles
 * Enhanced glass morphism effects and mobile optimizations
 */

/* ========================================
   Enhanced iOS16 Glass Effects
   ======================================== */

/* Advanced glass morphism */
.glass-advanced {
  background: linear-gradient(135deg,
      rgba(255, 255, 255, 0.1),
      rgba(255, 255, 255, 0.05));
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    0 8px 32px 0 rgba(31, 38, 135, 0.37),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.3);
}

/* Dynamic blur based on scroll */
.dynamic-blur,
.site-header {
  transition: backdrop-filter 0.3s ease, background 0.3s ease;
}

.site-header.scrolled {
  backdrop-filter: blur(30px) saturate(200%);
  -webkit-backdrop-filter: blur(30px) saturate(200%);
  background: rgba(15, 15, 35, 0.95);
}

/* Keep navigation style consistent when scrolled */
.site-header.scrolled .main-nav a {
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.site-header.scrolled .main-nav a:hover {
  background: rgba(0, 255, 127, 0.1) !important;
  color: #00ff7f !important;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 255, 127, 0.3);
}

/* ========================================
   Mobile-First Responsive Design
   ======================================== */

/* Touch-friendly interactions */
@media (hover: none) and (pointer: coarse) {
  .btn {
    min-height: 44px;
    min-width: 44px;
  }

  .post-card:hover {
    transform: none;
  }

  .post-card:active {
    transform: scale(0.98);
  }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {

  .glass,
  .glass-card {
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
  }

  /* Fix for iOS viewport height */
  .full-height {
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
  }
}

/* ========================================
   Enhanced Animation System
   ======================================== */

/* Scroll-triggered animations */
@keyframes slideInFromBottom {
  from {
    opacity: 0;
    transform: translateY(50px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Animation classes */
.animate-slide-up {
  animation: slideInFromBottom 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-slide-left {
  animation: slideInFromLeft 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-slide-right {
  animation: slideInFromRight 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-scale {
  animation: scaleIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Stagger animations */
.stagger-children>* {
  opacity: 0;
  transform: translateY(20px);
}

.stagger-children.animate>*:nth-child(1) {
  animation: slideInFromBottom 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.1s forwards;
}

.stagger-children.animate>*:nth-child(2) {
  animation: slideInFromBottom 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.2s forwards;
}

.stagger-children.animate>*:nth-child(3) {
  animation: slideInFromBottom 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.3s forwards;
}

.stagger-children.animate>*:nth-child(4) {
  animation: slideInFromBottom 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.4s forwards;
}

.stagger-children.animate>*:nth-child(5) {
  animation: slideInFromBottom 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.5s forwards;
}

.stagger-children.animate>*:nth-child(6) {
  animation: slideInFromBottom 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.6s forwards;
}

/* ========================================
   Advanced Payment Modal Styles
   ======================================== */

.payment-modal {
  backdrop-filter: blur(15px) saturate(120%);
  -webkit-backdrop-filter: blur(15px) saturate(120%);
  background: rgba(0, 0, 0, 0.4);
}

.payment-modal-content {
  background: linear-gradient(135deg,
      rgba(255, 255, 255, 0.9),
      rgba(255, 255, 255, 0.8));
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.payment-step {
  animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* QR Code styling */
.qr-container {
  position: relative;
  overflow: hidden;
}

.qr-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
  animation: shimmer 2s infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

/* ========================================
   Enhanced Error/Success States
   ======================================== */

.payment-error {
  position: fixed;
  top: 2rem;
  right: 2rem;
  max-width: 400px;
  z-index: 10001;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.payment-error.show {
  transform: translateX(0);
}

.error-content {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  background: linear-gradient(135deg, #fee, #fdd);
  border: 1px solid #fcc;
  border-left: 4px solid var(--accent-red);
  color: #900;
}

.error-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.error-message {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
}

.error-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #900;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.3s ease;
}

.error-close:hover {
  background: rgba(153, 0, 0, 0.1);
}

.success-notification {
  position: fixed;
  top: 2rem;
  right: 2rem;
  max-width: 400px;
  z-index: 10001;
  background: linear-gradient(135deg, #efe, #dfd);
  border: 1px solid #cfc;
  border-left: 4px solid var(--accent-green);
}

.notification-content {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
}

.notification-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.notification-text {
  flex: 1;
}

.notification-text h4 {
  margin: 0 0 0.25rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: #060;
}

.notification-text p {
  margin: 0;
  font-size: 0.875rem;
  color: #090;
}

.notification-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #060;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.3s ease;
}

.notification-close:hover {
  background: rgba(0, 102, 0, 0.1);
}

/* ========================================
   Enhanced Mobile Menu
   ======================================== */

.menu-toggle-icon span {
  transform-origin: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-toggle.active .menu-toggle-icon span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active .menu-toggle-icon span:nth-child(2) {
  opacity: 0;
  transform: scale(0);
}

.menu-toggle.active .menu-toggle-icon span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile menu animations */
.main-nav {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 768px) {
  .main-nav {
    transform: translateX(100%);
  }

  .main-nav.active {
    transform: translateX(0);
  }

  .main-nav ul {
    animation: slideInMenu 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }

  .main-nav li {
    opacity: 0;
    transform: translateX(20px);
    animation: slideInMenuItem 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }

  .main-nav li:nth-child(1) {
    animation-delay: 0.1s;
  }

  .main-nav li:nth-child(2) {
    animation-delay: 0.15s;
  }

  .main-nav li:nth-child(3) {
    animation-delay: 0.2s;
  }

  .main-nav li:nth-child(4) {
    animation-delay: 0.25s;
  }

  .main-nav li:nth-child(5) {
    animation-delay: 0.3s;
  }
}

@keyframes slideInMenu {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideInMenuItem {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ========================================
   Loading States and Micro-interactions
   ======================================== */

.loading-skeleton {
  background: linear-gradient(90deg,
      rgba(255, 255, 255, 0.1) 25%,
      rgba(255, 255, 255, 0.2) 50%,
      rgba(255, 255, 255, 0.1) 75%);
  background-size: 200% 100%;
  animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

/* Button loading states */
.btn.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Pulse effect for important elements */
.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

/* ========================================
   Accessibility Enhancements
   ======================================== */

/* Focus styles */
*:focus {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--accent-blue);
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: var(--radius-sm);
  z-index: 10000;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(0, 0, 0, 0.3);
  }

  .glass,
  .glass-card {
    border: 2px solid var(--glass-border);
    background: var(--glass-bg);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .parallax-element {
    transform: none !important;
  }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {

  .site-header,
  .site-footer,
  .payment-modal,
  .floating-elements,
  .post-actions,
  .btn {
    display: none !important;
  }

  .post-content,
  .single-post {
    background: white !important;
    box-shadow: none !important;
    border: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }
}

/* ========================================
   Dark Mode Enhancements
   ======================================== */

@media (prefers-color-scheme: dark) {
  .payment-modal-content {
    background: linear-gradient(135deg,
        rgba(28, 28, 30, 0.9),
        rgba(44, 44, 46, 0.8));
  }

  .error-content {
    background: linear-gradient(135deg, #400, #300);
    border-color: #600;
    color: #faa;
  }

  .success-notification {
    background: linear-gradient(135deg, #040, #030);
    border-color: #060;
  }

  .notification-text h4 {
    color: #afa;
  }

  .notification-text p {
    color: #9f9;
  }
}

/* ========================================
   CSS Grid Enhancements
   ======================================== */

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(350px, 100%), 1fr));
  gap: var(--spacing-lg);
  grid-auto-rows: masonry;
  /* Future CSS feature */
}

/* Fallback for browsers without masonry support */
@supports not (grid-auto-rows: masonry) {
  .content-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-lg);
  }

  .content-grid .post-card {
    flex: 1 1 350px;
    max-width: 400px;
  }
}

/* ========================================
   Performance Optimizations
   ======================================== */

/* GPU acceleration for smooth animations */
.gpu-accelerated {
  transform: translateZ(0);
  will-change: transform, opacity;
}

/* Optimize repaints */
.post-card,
.glass-card,
.btn {
  contain: layout style paint;
}

/* Optimize font loading */
@font-display: swap;

/* ========================================
   Modern CSS Features
   ======================================== */

/* Container queries (future feature) */
@container (min-width: 400px) {
  .post-card .post-actions {
    flex-direction: row;
  }
}

/* Scroll-driven animations (future feature) */
@scroll-timeline slide-in {
  source: auto;
  orientation: vertical;
}

.scroll-animate {
  animation: slideInFromBottom 1s linear;
  animation-timeline: slide-in;
  animation-range: entry 0% entry 100%;
}

/* ========================================
   Utility Classes
   ======================================== */

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.no-scroll {
  overflow: hidden;
}

.modal-open {
  overflow: hidden;
}

.menu-open {
  overflow: hidden;
}

/* Spacing utilities */
.p-0 {
  padding: 0;
}

.p-1 {
  padding: var(--spacing-xs);
}

.p-2 {
  padding: var(--spacing-sm);
}

.p-3 {
  padding: var(--spacing-md);
}

.p-4 {
  padding: var(--spacing-lg);
}

.m-0 {
  margin: 0;
}

.m-1 {
  margin: var(--spacing-xs);
}

.m-2 {
  margin: var(--spacing-sm);
}

.m-3 {
  margin: var(--spacing-md);
}

.m-4 {
  margin: var(--spacing-lg);
}

/* Display utilities */
.d-block {
  display: block;
}

.d-inline {
  display: inline;
}

.d-inline-block {
  display: inline-block;
}

.d-flex {
  display: flex;
}

.d-grid {
  display: grid;
}

.d-none {
  display: none;
}

/* Flexbox utilities */
.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-around {
  justify-content: space-around;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

/* Text utilities */
.text-left {
  text-align: left;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-justify {
  text-align: justify;
}

.font-thin {
  font-weight: 100;
}

.font-light {
  font-weight: 300;
}

.font-normal {
  font-weight: 400;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

.font-extrabold {
  font-weight: 800;
}

.font-black {
  font-weight: 900;
}

/* ========================================
   Header Search Box Styles
   ======================================== */

.header-search {
  margin-left: auto;
}

.search-form {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  padding: 0.5rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  width: 300px;
}

.search-form:hover,
.search-form:focus-within {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(0, 255, 127, 0.4);
  box-shadow: 0 0 0 3px rgba(0, 255, 127, 0.1);
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  padding: 0.5rem 1rem;
  color: #ffffff;
  font-size: 0.9rem;
  outline: none;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.search-submit {
  background: none;
  border: none;
  padding: 0.5rem;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.search-submit:hover {
  background: rgba(0, 255, 127, 0.2);
  color: #00ff7f;
}

.search-icon {
  font-size: 1rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .header-search {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 1rem;
    margin-left: 1rem;
    z-index: 1000;
  }

  .search-form {
    width: 100%;
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
  }

  .header-content {
    position: relative;
  }
}

/* Ensure proper header layout */
.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* ========================================
   Fix Single Page Layout Issues
   ======================================== */

/* Ensure consistent header height across all pages */
.site-header .header-content {
  padding: var(--spacing-sm) 0 !important;
}

/* Fix single page post header to not conflict with site header */
.single .post-header .header-content {
  padding: var(--spacing-xl) var(--spacing-lg) var(--spacing-lg) !important;
}

/* Force black theme for all pages - override auto dark mode */
:root {
  --primary-bg: rgba(0, 0, 0, 0.15) !important;
  --secondary-bg: rgba(0, 0, 0, 0.25) !important;
  --glass-bg: rgba(0, 0, 0, 0.15) !important;
  --glass-border: rgba(255, 255, 255, 0.1) !important;
}