/**
 * Liquid Flowing Glass Theme with Glowing Edges
 * Theme: liquid-glass
 */

:root[data-theme="liquid-glass"] {
    /* Base Colors */
    --primary-color: #00f0ff;
    --secondary-color: #7000ff;
    --accent-color: #00ff9d;
    
    --bg-body: #050510;
    --bg-panel: rgba(20, 20, 35, 0.4);
    --bg-input: rgba(0, 0, 0, 0.3);
    
    /* Text */
    --text-main: #e0e0ff;
    --text-secondary: #a0a0cc;
    --text-muted: #606080;
    
    /* Borders & Glows */
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --neon-glow: 0 0 10px rgba(0, 240, 255, 0.3);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    /* Overrides for existing components */
    --card-bg: rgba(255, 255, 255, 0.02);
    --header-bg: rgba(5, 5, 16, 0.8);
    --sidebar-bg: rgba(5, 5, 16, 0.8);
}

[data-theme="liquid-glass"] body {
    background-color: var(--bg-body);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(112, 0, 255, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(0, 240, 255, 0.15), transparent 25%);
    color: var(--text-main);
}

/* ==========================================================================
   GLOBAL LIQUID GLASS EFFECTS (Applied to ALL Themes)
   ========================================================================== */

/* Glassmorphism Cards with Flowing Shimmer - Global */
.card,
.panel,
.compact-card,
.modal-content,
.login-card {
    /* Base glass properties that enhance any background color */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    /* Soften existing borders to blend with glass effect */
    border-color: rgba(255, 255, 255, 0.1); 
}

/* Flowing Light Shimmer for Cards - Global */
.card::before,
.panel::before,
.compact-card::before,
.modal-content::before,
.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.03) 40%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.03) 60%,
        transparent 100%
    );
    transform: skewX(-25deg);
    pointer-events: none;
    animation: glassShimmer 8s infinite ease-in-out;
    z-index: 0;
}

/* Ensure content sits above the shimmer */
.card > *,
.panel > *,
.compact-card > *,
.modal-content > *,
.login-card > * {
    position: relative;
    z-index: 1;
}

/* Inputs styling - Global Glass Effect */
header,
.form-group input,
.form-group select,
.form-group textarea {
    transition: all 0.3s ease;
}

/* Glowing Edges on Focus/Active - Global */
input:focus,
select:focus,
textarea:focus,
.btn-primary:focus,
.active {
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.2), inset 0 0 10px rgba(0, 240, 255, 0.1);
    outline: none;
    transition: box-shadow 0.3s ease;
}

/* Liquid Buttons - Global */
.btn-primary {
    background-size: 300% 300%;
    /* Use a gradient that respects the brand but adds flow */
    background-image: linear-gradient(
        115deg,
        var(--color-primary, #9F299F) 0%, 
        #B84CB8 25%, 
        #00ff9d 50%, 
        #B84CB8 75%,
        var(--color-primary, #9F299F) 100%
    ) !important; /* Force liquid gradient over standard colors */
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    animation: liquidFlow 6s ease infinite;
    z-index: 1;
}

.btn-primary:hover {
    box-shadow: 0 0 25px rgba(159, 41, 159, 0.5), inset 0 0 10px rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    animation-duration: 3s; /* Speed up on hover */
}

/* Ripple effect container for button - Global */
.btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.2), transparent);
    border-radius: inherit;
    pointer-events: none;
}

/* Secondary Button with Glass Effect - Global */
.btn-secondary,
.btn-outline {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}

.btn-secondary:hover,
.btn-outline:hover {
    box-shadow: 0 0 15px rgba(0, 255, 157, 0.2);
}

/* ==========================================================================
   THEME SPECIFIC OVERRIDES (Specific Colors for Liquid Theme)
   ========================================================================== */

/* Glassmorphism Cards with Flowing Shimmer */
[data-theme="liquid-glass"] .card,
[data-theme="liquid-glass"] .panel,
[data-theme="liquid-glass"] .compact-card,
[data-theme="liquid-glass"] .modal-content,
[data-theme="liquid-glass"] .login-card {
    background: var(--bg-panel);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--card-shadow), inset 0 0 20px rgba(255, 255, 255, 0.02);
}

/* Inputs styling in glass theme */
[data-theme="liquid-glass"] header,
[data-theme="liquid-glass"] .form-group input,
[data-theme="liquid-glass"] .form-group select,
[data-theme="liquid-glass"] .form-group textarea {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

/* Glowing Edges on Focus/Active */
[data-theme="liquid-glass"] input:focus,
[data-theme="liquid-glass"] select:focus,
[data-theme="liquid-glass"] textarea:focus,
[data-theme="liquid-glass"] .btn-primary:focus,
[data-theme="liquid-glass"] .active {
    border-color: var(--primary-color);
    background: rgba(0, 240, 255, 0.05);
}

/* Liquid Buttons specific colors for Liquid Theme */
[data-theme="liquid-glass"] .btn-primary {
    background-image: linear-gradient(
        115deg,
        rgba(0, 240, 255, 0.2) 0%, 
        rgba(112, 0, 255, 0.3) 25%, 
        rgba(0, 255, 157, 0.2) 50%, 
        rgba(112, 0, 255, 0.3) 75%,
        rgba(0, 240, 255, 0.2) 100%
    ) !important;
}

/* Animations */
@keyframes liquidFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes glassShimmer {
    0% { left: -150%; opacity: 0; }
    40% { opacity: 0; }
    50% { opacity: 1; }
    60% { opacity: 0; }
    100% { left: 150%; opacity: 0; }
}

/* WebGL Canvas Background */
#webgl-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

[data-theme="liquid-glass"] #webgl-particles {
    opacity: 1;
}

/* Liquid Text Effect */
[data-theme="liquid-glass"] h1, 
[data-theme="liquid-glass"] h2,
[data-theme="liquid-glass"] .app-title {
    background: linear-gradient(to right, #00f0ff, #00ff9d, #00f0ff);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent; 
    animation: liquidText 5s linear infinite;
}

@keyframes liquidText {
    to {
        background-position: 200% center;
    }
}
