/* ==========================================================================
   REDDY MATRIMONY — PWA + MODERN DESIGN SYSTEM
   Adds: install banner, glass morphism, skeleton loaders,
         advanced responsive utilities, PWA helpers.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS CUSTOM PROPERTIES — design tokens
   -------------------------------------------------------------------------- */
:root {
    --rm-pwa-primary: {{ get_setting('base_color', '#FD2C79') }};
    --rm-pwa-secondary: {{ get_setting('secondary_color', '#FD655B') }};
    --rm-gold: #D4AF37;
    --rm-gold-light: #F0D878;
    --rm-gold-pale: #FFF8E1;
    --rm-shadow-soft: 0 10px 40px rgba(36, 7, 22, 0.10);
    --rm-shadow-md: 0 14px 50px rgba(36, 7, 22, 0.14);
    --rm-shadow-lg: 0 22px 70px rgba(36, 7, 22, 0.18);
    --rm-radius: 12px;
    --rm-radius-lg: 18px;
    --rm-radius-xl: 24px;
}

/* --------------------------------------------------------------------------
   2. PWA INSTALL BANNER
   -------------------------------------------------------------------------- */
.pwa-install-banner {
    position: fixed;
    bottom: calc(1rem + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    z-index: 1040;
    width: calc(100% - 2rem);
    max-width: 420px;
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1),
                opacity 0.35s ease;
    pointer-events: none;
}

.pwa-install-banner.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.pwa-install-content {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(221, 173, 181, 0.35);
    border-radius: 16px;
    box-shadow: var(--rm-shadow-lg);
}

.pwa-install-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--rm-pwa-primary), var(--rm-pwa-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(214, 51, 108, 0.3);
}

.pwa-install-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pwa-install-text {
    flex: 1;
    min-width: 0;
}

.pwa-install-text strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: #2D1B2E;
    margin-bottom: 0.15rem;
}

.pwa-install-text span {
    display: block;
    font-size: 0.78rem;
    color: #6B5B6C;
    line-height: 1.35;
}

.pwa-install-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.pwa-install-btn,
.pwa-dismiss-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pwa-install-btn {
    background: linear-gradient(135deg, var(--rm-pwa-primary), var(--rm-pwa-secondary));
    color: #fff;
    box-shadow: 0 4px 14px rgba(214, 51, 108, 0.35);
}

.pwa-install-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(214, 51, 108, 0.45);
}

.pwa-dismiss-btn {
    background: rgba(221, 173, 181, 0.18);
    color: #8B6B7B;
}

.pwa-dismiss-btn:hover {
    background: rgba(221, 173, 181, 0.32);
    transform: scale(1.05);
}

/* --------------------------------------------------------------------------
   3. SKELETON LOADERS
   -------------------------------------------------------------------------- */
.rm-skeleton {
    background: linear-gradient(90deg, #F3EEF0 25%, #FAF8F9 50%, #F3EEF0 75%);
    background-size: 200% 100%;
    border-radius: 8px;
    animation: rmSkeletonPulse 1.5s ease-in-out infinite;
}

@keyframes rmSkeletonPulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.rm-skeleton-text {
    height: 0.9rem;
    margin-bottom: 0.55rem;
}

.rm-skeleton-title {
    height: 1.4rem;
    width: 70%;
    margin-bottom: 0.8rem;
}

.rm-skeleton-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
}

.rm-skeleton-card {
    border-radius: var(--rm-radius-lg);
    height: 260px;
}

/* --------------------------------------------------------------------------
   4. GLASS MORPHISM UTILITIES
   -------------------------------------------------------------------------- */
.rm-glass {
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: var(--rm-shadow-soft);
}

.rm-glass-dark {
    background: rgba(69, 16, 43, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(221, 173, 181, 0.25);
}

/* --------------------------------------------------------------------------
   5. MODERN FORM ENHANCEMENTS
   -------------------------------------------------------------------------- */
.rm-floating-label {
    position: relative;
    margin-bottom: 1.1rem;
}

.rm-floating-label .form-control,
.rm-floating-label .bootstrap-select .dropdown-toggle {
    padding: 0.85rem 1rem 0.5rem;
    height: auto;
    min-height: 56px;
    border-radius: 12px;
    border-color: #E8E0E3;
    transition: all 0.2s ease;
}

.rm-floating-label .form-label {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    color: #8B7B8C;
    font-size: 0.92rem;
    pointer-events: none;
    transition: all 0.2s ease;
    background: transparent;
    padding: 0 0.25rem;
}

.rm-floating-label .form-control:focus,
.rm-floating-label .form-control:not(:placeholder-shown) {
    padding-top: 1.15rem;
    padding-bottom: 0.35rem;
}

.rm-floating-label .form-control:focus ~ .form-label,
.rm-floating-label .form-control:not(:placeholder-shown) ~ .form-label {
    top: 0.55rem;
    transform: translateY(0);
    font-size: 0.72rem;
    color: var(--rm-pwa-primary);
    font-weight: 600;
}

.rm-floating-label .form-control:focus {
    border-color: var(--rm-pwa-primary);
    box-shadow: 0 0 0 4px rgba(253, 44, 121, 0.12);
}

/* --------------------------------------------------------------------------
   6. SMOOTH REVEAL ANIMATIONS
   -------------------------------------------------------------------------- */
.rm-reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s cubic-bezier(0.22, 0.61, 0.36, 1),
                transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.rm-reveal.rm-in {
    opacity: 1;
    transform: none;
}

.rm-reveal-delay-1 { transition-delay: 0.1s; }
.rm-reveal-delay-2 { transition-delay: 0.2s; }
.rm-reveal-delay-3 { transition-delay: 0.3s; }

@media (prefers-reduced-motion: reduce) {
    .rm-reveal { opacity: 1; transform: none; transition: none; }
}

/* --------------------------------------------------------------------------
   7. HOVER MICRO-INTERACTIONS
   -------------------------------------------------------------------------- */
.rm-lift {
    transition: transform 0.25s cubic-bezier(0.22, 0.61, 0.36, 1),
                box-shadow 0.25s ease;
}

.rm-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--rm-shadow-md);
}

/* Ripple effect */
.rm-ripple {
    position: relative;
    overflow: hidden;
}

.rm-ripple::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    transform: scale(0);
    pointer-events: none;
    opacity: 0;
}

.rm-ripple:active::after {
    animation: rmRipple 0.6s linear;
}

@keyframes rmRipple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* --------------------------------------------------------------------------
   8. RESPONSIVE IMPROVEMENTS
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .pwa-install-banner {
        width: calc(100% - 1.5rem);
        bottom: calc(0.75rem + env(safe-area-inset-bottom));
    }

    .pwa-install-content {
        padding: 0.75rem 0.85rem;
    }

    .pwa-install-icon {
        width: 42px;
        height: 42px;
    }

    .pwa-install-text strong {
        font-size: 0.9rem;
    }

    .pwa-install-text span {
        font-size: 0.74rem;
    }
}

@media (max-width: 767.98px) {
    /* Improve touch targets */
    .btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .form-control {
        min-height: 48px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    /* Better spacing for mobile sections */
    .rm-section {
        padding: 3rem 0 !important;
    }

    /* Improve member cards on small screens */
    .rm-profile-card {
        margin-bottom: 1rem;
    }
}

@media (max-width: 575.98px) {
    /* Full-width CTAs on small mobile */
    .btn-block-sm {
        width: 100%;
        display: block;
    }
}

/* --------------------------------------------------------------------------
   9. PWA STANDALONE / IOS SAFARI FIXES
   -------------------------------------------------------------------------- */
@supports (-webkit-touch-callout: none) {
    /* iOS-specific */
    .aiz-mobile-bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
    }

    body.pwa-ready {
        -webkit-tap-highlight-color: transparent;
    }
}

/* Safe area insets for notched devices */
.rm-safe-top { padding-top: env(safe-area-inset-top); }
.rm-safe-bottom { padding-bottom: env(safe-area-inset-bottom); }
.rm-safe-left { padding-left: env(safe-area-inset-left); }
.rm-safe-right { padding-right: env(safe-area-inset-right); }

/* --------------------------------------------------------------------------
   10. ACCESSIBILITY
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible styles */
*:focus-visible {
    outline: 2px solid var(--rm-pwa-primary);
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}

/* --------------------------------------------------------------------------
   11. DARK MODE SUPPORT (system preference)
   -------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
    .pwa-install-content {
        background: rgba(45, 27, 46, 0.95);
        border-color: rgba(221, 173, 181, 0.2);
    }

    .pwa-install-text strong {
        color: #FFF5F7;
    }

    .pwa-install-text span {
        color: #CDBFC8;
    }
}

/* --------------------------------------------------------------------------
   12. TOAST NOTIFICATIONS
   -------------------------------------------------------------------------- */
.rm-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1050;
    max-width: 360px;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.rm-toast.show {
    transform: translateX(0);
}

.rm-toast-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.2rem;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    border-radius: 14px;
    box-shadow: var(--rm-shadow-lg);
    border-left: 4px solid var(--rm-pwa-primary);
}

/* --------------------------------------------------------------------------
   13. LOADER SPINNER
   -------------------------------------------------------------------------- */
.rm-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(253, 44, 121, 0.15);
    border-top-color: var(--rm-pwa-primary);
    border-radius: 50%;
    animation: rmSpin 0.8s linear infinite;
}

@keyframes rmSpin {
    to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   14. IMAGE LAZY LOAD
   -------------------------------------------------------------------------- */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.4s ease;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* --------------------------------------------------------------------------
   15. STANDALONE PWA BODY BACKGROUND
   -------------------------------------------------------------------------- */
@media all and (display-mode: standalone) {
    body {
        background: #fff;
    }

    /* Hide install banner when already installed */
    .pwa-install-banner {
        display: none !important;
    }
}