/* ============================================
   LIQUID GLASS V2 - APPLE-INSPIRED DESIGN SYSTEM
   ============================================

   This is a complete redesign of the liquid glass effect inspired by
   Apple's WWDC 2025 Liquid Glass design language.

   KEY IMPROVEMENTS OVER V1:
   1. SVG displacement filter for actual refraction (Chromium)
   2. Three-layer glass structure (highlight, shadow, illumination)
   3. Inner edge shadows simulating light bending
   4. Improved blur/saturation for glass-like appearance
   5. Graceful fallback for non-Chromium browsers

   BROWSER SUPPORT:
   - Chromium (Chrome, Edge, Opera): Full effect with SVG distortion
   - Safari: Fallback to enhanced glassmorphism (no distortion)
   - Firefox: Fallback to enhanced glassmorphism (no distortion)

   USAGE:
   1. Include the SVG filters in your HTML (see bottom of file)
   2. Apply .liquid-glass to elements
   3. Add .liquid-glass--subtle, --medium, or --strong for intensity
   4. Add .liquid-glass--rounded for pill shape

   ============================================ */

/* ============================================
   CSS CUSTOM PROPERTIES
   ============================================ */

:root {
    /* === GLASS LAYER COLORS === */
    /* Using the unified color system from shared.css */
    --lg-illumination-bg: rgba(255, 255, 255, 0.06);
    --lg-illumination-saturate: 1.3;
    --lg-illumination-blur: 20px;

    /* Highlight layer - subtle */
    --lg-highlight-color: rgba(255, 255, 255, 0.3);

    /* Shadow layer */
    --lg-shadow-color: rgba(0, 0, 0, 0.1);

    /* === INNER EDGE EFFECTS === */
    --lg-edge-highlight: inset 0 1px 1px rgba(255, 255, 255, 0.1);
    --lg-edge-shadow: none;

    /* === OUTER SHADOW === */
    --lg-outer-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.15);
    --lg-outer-glow: none;

    /* === BORDER === */
    --lg-border-color: var(--border-subtle, #262626);
    --lg-border-width: 1px;

    /* === ACCENT TINT (brand cyan) === */
    --lg-tint-accent: rgba(39, 197, 255, 0.06);

    /* === ANIMATION TIMING === */
    --lg-transition-duration: 0.15s;
    --lg-transition-easing: ease;
}

/* ============================================
   BASE LIQUID GLASS CLASS
   ============================================ */

.liquid-glass {
    position: relative;

    /* === MINIMAL GLASS EFFECT === */
    background: var(--bg-elevated, #161616);
    backdrop-filter: blur(var(--lg-illumination-blur)) saturate(var(--lg-illumination-saturate));
    -webkit-backdrop-filter: blur(var(--lg-illumination-blur)) saturate(var(--lg-illumination-saturate));

    /* === BORDERS === */
    border: var(--lg-border-width) solid var(--lg-border-color);
    box-shadow: var(--lg-outer-shadow);

    /* === SHAPE === */
    border-radius: 8px;
    overflow: hidden;

    /* === TRANSITIONS === */
    transition:
        background var(--lg-transition-duration) var(--lg-transition-easing),
        border-color var(--lg-transition-duration) var(--lg-transition-easing);
}

/* === CONTENT CONTAINER === */
.liquid-glass > * {
    position: relative;
    z-index: 1;
}

/* ============================================
   INTENSITY VARIANTS
   ============================================ */

/* Subtle - for badges, small elements */
.liquid-glass--subtle {
    background: var(--bg-elevated, #161616);
    border-color: var(--border-subtle, #262626);
}

/* Strong - for focal elements */
.liquid-glass--strong {
    background: var(--bg-hover, #1f1f1f);
    border-color: var(--border-default, #333333);
}

/* ============================================
   INTERACTIVE STATES
   ============================================ */

/* Hover */
.liquid-glass:hover {
    background: var(--bg-hover, #1f1f1f);
    border-color: var(--border-default, #333333);
}

/* Active/Pressed */
.liquid-glass:active {
    background: var(--bg-subtle, #1a1a1a);
}

/* Focus */
.liquid-glass:focus-visible {
    outline: 2px solid var(--accent, #27C5FF);
    outline-offset: 2px;
}

/* Disabled */
.liquid-glass:disabled,
.liquid-glass.disabled {
    opacity: 0.4;
    pointer-events: none;
    cursor: not-allowed;
}

/* ============================================
   SHAPE VARIANTS
   ============================================ */

.liquid-glass--rounded {
    border-radius: 9999px;
}

.liquid-glass--square {
    border-radius: 4px;
}

.liquid-glass--circle {
    border-radius: 50%;
    aspect-ratio: 1;
}

/* ============================================
   LIQUID GLASS BUTTON
   ============================================ */

.btn-liquid-glass {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;

    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #f5f5f5);
    text-decoration: none;
    white-space: nowrap;

    cursor: pointer;
    background: var(--bg-elevated, #161616);
    border: 1px solid var(--border-subtle, #262626);
    
    transition: all 0.15s ease;
}

.btn-liquid-glass:hover {
    background: var(--bg-hover, #1f1f1f);
    border-color: var(--border-default, #333333);
}

/* Primary variant - accent tint */
.btn-liquid-glass--primary {
    background: var(--accent-bg, rgba(39, 197, 255, 0.08));
    border-color: var(--accent-border, rgba(39, 197, 255, 0.2));
}

.btn-liquid-glass--primary:hover {
    background: rgba(39, 197, 255, 0.12);
    border-color: rgba(39, 197, 255, 0.3);
}

/* Icon button - circular */
.btn-liquid-glass--icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 50%;
}

/* Small button */
.btn-liquid-glass--sm {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 6px;
}

/* Large button */
.btn-liquid-glass--lg {
    padding: 16px 32px;
    font-size: 16px;
    border-radius: 10px;
}

/* ============================================
   LIQUID GLASS CARD
   ============================================ */

.card-liquid-glass {
    padding: 24px;
    border-radius: 12px;
    background: var(--bg-surface, #111111);
    border: 1px solid var(--border-subtle, #262626);
}

.card-liquid-glass--elevated {
    box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.2);
}

/* ============================================
   LIQUID GLASS NAVIGATION
   ============================================ */

.nav-liquid-glass {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px;
    border-radius: 10px;
    background: var(--bg-surface, #111111);
    border: 1px solid var(--border-subtle, #262626);
}

.nav-liquid-glass__item {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;

    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary, #a3a3a3);
    text-decoration: none;

    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;

    cursor: pointer;
    transition: all 0.15s ease;
}

.nav-liquid-glass__item:hover {
    color: var(--text-primary, #f5f5f5);
    background: var(--bg-hover, #1f1f1f);
}

.nav-liquid-glass__item--active {
    color: var(--bg-base, #0a0a0a);
    background: var(--text-primary, #f5f5f5);
    font-weight: 600;
}

/* ============================================
   LIQUID GLASS INPUT
   ============================================ */

.input-liquid-glass {
    width: 100%;
    padding: 12px 16px;

    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary, #f5f5f5);

    background: var(--bg-elevated, #161616);
    border: 1px solid var(--border-subtle, #262626);
    border-radius: 8px;

    transition: all 0.15s ease;
}

.input-liquid-glass::placeholder {
    color: var(--text-tertiary, #737373);
}

.input-liquid-glass:hover {
    background: var(--bg-hover, #1f1f1f);
    border-color: var(--border-default, #333333);
}

.input-liquid-glass:focus {
    outline: none;
    border-color: var(--accent, #27C5FF);
    box-shadow: 0 0 0 3px var(--accent-bg, rgba(39, 197, 255, 0.08));
}

/* ============================================
   ANIMATED SHIMMER EFFECT (loading states only)
   ============================================ */

.liquid-glass--shimmer {
    position: relative;
    overflow: hidden;
}

.liquid-glass--shimmer::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.08) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: liquidShimmer 2s ease-in-out infinite;
}

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

/* ============================================
   ACCESSIBILITY - REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .liquid-glass,
    .liquid-glass--shimmer::after {
        animation: none !important;
        transition-duration: 0.05s !important;
    }
}

/* ============================================
   FALLBACK FOR NON-BACKDROP-FILTER BROWSERS
   ============================================ */

@supports not (backdrop-filter: blur(1px)) {
    .liquid-glass {
        background: var(--bg-elevated, #161616);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

/* ============================================
   BUTTON VARIANT MODIFIERS
   ============================================ */

/* Secondary - muted appearance */
.btn-glass-secondary {
    color: var(--text-secondary, #a3a3a3);
}

.btn-glass-secondary:hover:not(:disabled) {
    color: var(--text-primary, #f5f5f5);
}

/* Success - for positive actions */
.btn-success-glass {
    background: var(--status-success-bg, rgba(134, 239, 172, 0.08));
    border-color: rgba(134, 239, 172, 0.2);
    color: var(--status-success, #86efac);
}

.btn-success-glass:hover:not(:disabled) {
    background: rgba(134, 239, 172, 0.12);
    border-color: rgba(134, 239, 172, 0.3);
}

/* Danger - for destructive actions */
.btn-danger-glass {
    background: var(--status-error-bg, rgba(252, 165, 165, 0.08));
    border-color: rgba(252, 165, 165, 0.2);
    color: var(--status-error, #fca5a5);
}

.btn-danger-glass:hover:not(:disabled) {
    background: rgba(252, 165, 165, 0.12);
    border-color: rgba(252, 165, 165, 0.3);
}
