/* 
 * VIVAYASA Global Styles & Theme Variables 
 * Fonts: Playfair Display (Headings), Inter (Body)
 */

:root {
    /* Default to Light Theme */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    /* Slate 50 */
    --text-primary: #1e293b;
    /* Slate 800 */
    --text-secondary: #64748b;
    /* Slate 500 */
    --accent-primary: #0f172a;
    /* Slate 900 */
    --accent-secondary: #334155;
    /* Slate 700 */
    --border-color: #e2e8f0;
    /* Slate 200 */

    --nav-glass: rgba(255, 255, 255, 0.8);
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Dark Theme Data Attribute */
[data-theme="dark"] {
    --bg-primary: #020617;
    /* Midnight Blue */
    --bg-secondary: #0f172a;
    /* Darker Blue */
    --text-primary: #f1f5f9;
    /* Slate 100 */
    --text-secondary: #94a3b8;
    /* Slate 400 */
    --accent-primary: #10b981;
    /* Emerald 500 */
    --accent-secondary: #34d399;
    /* Emerald 400 */
    --border-color: #1e293b;
    /* Slate 800 */

    --nav-glass: rgba(2, 6, 23, 0.8);
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
}

/* Zen Theme Data Attribute */
[data-theme="zen"] {
    --bg-primary: #F5F5DC;
    /* Beige/Sand */
    --bg-secondary: #E8E8D0;
    /* Slightly Darker Sand */
    --text-primary: #3E2723;
    /* Earth Brown */
    --text-secondary: #5D4037;
    /* Lighter Brown */
    --accent-primary: #8A9A5B;
    /* Sage Green */
    --accent-secondary: #6D7A48;
    /* Darker Sage */
    --border-color: #D7CCC8;
    /* Light Brown Border */

    --nav-glass: rgba(245, 245, 220, 0.85);
    --shadow-soft: 0 4px 6px -1px rgba(62, 39, 35, 0.1), 0 2px 4px -1px rgba(62, 39, 35, 0.05);
}

/* Transition for Theme Switching */
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}

/* Typography Overrides */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Playfair Display', serif;
}

.brand-logo {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    letter-spacing: 3px;
}

body {
    font-family: 'Inter', sans-serif;
}

/* Glassmorphism Utilities */
.glass {
    background: var(--nav-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Hide sections for SPA Router */
section.page-section {
    display: none;
    animation: fadeIn 0.5s ease-out;
}

section.page-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-pulse-slow {
    animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: .7;
    }
}

/* 3D Flip Card Styles (NLP) */
.perspective-1000 {
    perspective: 1000px;
}

.transform-style-3d {
    transform-style: preserve-3d;
}

.backface-hidden {
    backface-visibility: hidden;
}

.rotate-y-180 {
    transform: rotateY(180deg);
}

.flip-card-inner {
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

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

.flip-card-front,
.flip-card-back {
    backface-visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* Theta Healing Animations */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.animate-shimmer {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.4) 50%,
            rgba(255, 255, 255, 0) 100%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite linear;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

.theta-glow {
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

.download-card.received {
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
}



/* Sound Sanctuary - Pulse Animation */
@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.animate-pulse-fast {
    animation: pulse 1s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Laughter Method */
@keyframes laugh-shake {

    0%,
    100% {
        transform: rotate(-3deg);
    }

    50% {
        transform: rotate(3deg);
    }
}

.animate-laugh {
    animation: laugh-shake 0.3s ease-in-out infinite;
}

.play-btn-pulse {
    animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(100, 116, 139, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(100, 116, 139, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(100, 116, 139, 0);
    }
}

/* --- Sound Sanctuary Piano --- */
#piano-container {
    padding-bottom: 10px;
    /* Create space for shadow/active states */
}

.piano-key {
    position: relative;
    float: left;
    margin: 0 2px;
    border-radius: 0 0 5px 5px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.1s ease;
    user-select: none;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 10px;
}

.piano-key.white {
    width: 40px;
    height: 140px;
    background: linear-gradient(#fff 0%, #eee 100%);
    border: 1px solid #ccc;
    z-index: 1;
    color: #999;
}

.piano-key.black {
    width: 28px;
    height: 90px;
    background: linear-gradient(#333 0%, #000 100%);
    border: 1px solid #000;
    margin-left: -16px;
    margin-right: -14px;
    z-index: 2;
    color: #555;
    padding-bottom: 8px;
}

.piano-key span {
    font-size: 10px;
    pointer-events: none;
    font-weight: 500;
}

.piano-key.white span {
    color: var(--text-secondary);
}

.piano-key.black span {
    color: #888;
}

/* Active States */
.piano-key.white:active,
.piano-key.white.active {
    background: #ddd;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transform: translateY(2px);
    background: linear-gradient(to bottom, #fff 0%, var(--accent-secondary) 100%);
    border-color: var(--accent-primary);
}

.piano-key.black:active,
.piano-key.black.active {
    background: #222;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transform: translateY(2px);
    background: linear-gradient(to bottom, #333 0%, var(--accent-primary) 100%);
}

/* --- Bass Keys --- */
.bass-key {
    position: relative;
    float: left;
    margin: 0 2px;
    border-radius: 0 0 5px 5px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
    transition: all 0.1s ease;
    user-select: none;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 10px;
}

.bass-key.white {
    width: 45px;
    /* Slightly wider */
    height: 140px;
    background: linear-gradient(#2d3748 0%, #1a202c 100%);
    /* Dark Slate */
    border: 1px solid #4a5568;
    z-index: 1;
    color: #a0aec0;
}

.bass-key.black {
    width: 32px;
    height: 90px;
    background: linear-gradient(#000 0%, #171923 100%);
    border: 1px solid #2d3748;
    margin-left: -18px;
    margin-right: -16px;
    z-index: 2;
    color: #718096;
    padding-bottom: 8px;
}

.bass-key span {
    font-size: 10px;
    pointer-events: none;
    font-weight: 600;
}

/* Bass Active States */
.bass-key.white:active,
.bass-key.white.active {
    background: linear-gradient(to bottom, #2d3748 0%, #4c51bf 100%);
    /* Indigo glow */
    border-color: #667eea;
    transform: translateY(2px);
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.3);
}

.bass-key.black:active,
.bass-key.black.active {
    background: linear-gradient(to bottom, #000 0%, #434190 100%);
    transform: translateY(2px);
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.3);
}

/* --- Drum Pads --- */
.drum-pad {
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    user-select: none;
    transition: transform 0.1s;
}

.drum-pad:active,
.drum-pad.active {
    transform: scale(0.92);
}

.pad-surface {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    border: 2px solid;
    margin-bottom: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2), inset 0 0 10px rgba(0, 0, 0, 0.2);
    transition: all 0.1s;
}

.drum-pad:active .pad-surface,
.drum-pad.active .pad-surface {
    background-color: currentColor;
    /* Simplified flash effect */
    box-shadow: 0 0 15px currentColor;
    border-color: #fff;
    filter: brightness(1.5);
}

.drum-pad span {
    font-size: 10px;
    color: var(--text-textMuted);
    opacity: 0.7;
    font-weight: 500;
}

/* --- Loop Controls --- */
.btn-loop {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--borderColor);
    color: var(--textMain);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

.btn-loop:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.btn-loop.recording {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
    animation: pulse 1s infinite;
}

.btn-loop.playing {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.5);
    color: #6ee7b7;
}