/* ==========================================================================
   CSS Variables & Theme Definitions
   Desain premium dengan kontras yang disesuaikan untuk mode terang/gelap
   ========================================================================== */
[data-theme="dark"] {
    --card-bg: rgba(18, 21, 30, 0.45);
    --card-border: rgba(255, 255, 255, 0.06);
    --card-border-hover: rgba(124, 58, 237, 0.35);
    --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --card-shadow-hover: 0 16px 48px rgba(0, 0, 0, 0.5);
    --navbar-bg: rgba(14, 16, 23, 0.75);
    --glass-bg: rgba(18, 21, 30, 0.5);
    --glass-highlight: inset 0 1px 1px rgba(255, 255, 255, 0.08);
}
[data-theme="light"] {
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(255, 255, 255, 0.6);
    --card-border-hover: rgba(124, 58, 237, 0.25);
    --card-shadow: 0 8px 24px rgba(149, 157, 165, 0.1);
    --card-shadow-hover: 0 20px 40px rgba(149, 157, 165, 0.15);
    --navbar-bg: rgba(255, 255, 255, 0.85);
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-highlight: inset 0 1px 1px rgba(255, 255, 255, 1);
}

/* ==========================================================================
   Ambient Orbs (Background Glow Effect)
   Dioptimalkan dengan will-change agar tidak membebani CPU (GPU Accelerated)
   ========================================================================== */
.ambient-orb {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(140px);
    opacity: 0.15;
    animation: orbDrift 30s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    will-change: transform, opacity;
}
.ambient-orb.orb-1 {
    width: 700px; height: 700px;
    background: radial-gradient(circle, #7c3aed 0%, #3e92cc 60%, transparent 100%);
    top: -25%; left: -15%;
}
.ambient-orb.orb-2 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, #d81159 0%, #7c3aed 60%, transparent 100%);
    bottom: -25%; right: -15%;
    animation-delay: -15s;
}
[data-theme="light"] .ambient-orb { opacity: 0.08; filter: blur(120px); }

@keyframes orbDrift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(4vw, -4vh) scale(1.05); }
    66% { transform: translate(-3vw, 3vh) scale(0.95); }
}

/* ==========================================================================
   Typography Enhancements
   ========================================================================== */
.text-gradient {
    background: linear-gradient(135deg, #7c3aed 0%, #d81159 45%, #3e92cc 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 8s ease-in-out infinite;
    will-change: background-position;
}
@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ==========================================================================
   Premium Glassmorphism
   Efek kaca yang modern dengan highlight di tepi dalam
   ========================================================================== */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow), var(--glass-highlight);
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.glass:hover {
    border-color: var(--card-border-hover);
    box-shadow: var(--card-shadow-hover), var(--glass-highlight);
}

/* Tailwind Dark Mode Overrides for consistency */
[data-theme="dark"] .dark\:bg-white\/\[0\.03\],
[data-theme="dark"] .dark\:bg-white\/\[0\.04\],
[data-theme="dark"] .dark\:bg-white\/\[0\.06\] {
    background: rgba(30, 35, 48, 0.4) !important;
    backdrop-filter: blur(16px);
    border-color: rgba(255, 255, 255, 0.06) !important;
}
[data-theme="dark"] .dark\:border-white\/\[0\.06\] {
    border-color: rgba(255, 255, 255, 0.06) !important;
}

/* ==========================================================================
   Modern Animations (Apple/Stripe Style)
   Menggunakan cubic-bezier untuk gerakan yang "snappy"
   ========================================================================== */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes scaleOut { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.95); } }

/* Animation Utility Classes */
.animate-fade-in { animation: fadeIn 0.3s ease-out both; }
.animate-fade-out { animation: fadeOut 0.3s ease-in both; }
.animate-scale-in { animation: scaleIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.animate-scale-out { animation: scaleOut 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.animate-fade-up { animation: fadeUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.animate-fade-up-1 { animation: fadeUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s both; }
.animate-fade-up-2 { animation: fadeUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s both; }
.animate-fade-up-3 { animation: fadeUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.3s both; }
.animate-fade-up-4 { animation: fadeUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.4s both; }
.animate-float { animation: float 4s ease-in-out infinite; will-change: transform; }

/* ==========================================================================
   Button Shimmer Effect
   Efek sapuan cahaya mengkilap pada tombol CTA
   ========================================================================== */
.btn-shimmer {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.btn-shimmer::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 30%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    animation: shimmer 3s infinite;
    z-index: 1;
    pointer-events: none;
}

/* ==========================================================================
   Custom Elegant Scrollbar
   ========================================================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { 
    background: rgba(124, 58, 237, 0.2); 
    border-radius: 10px; 
    transition: background 0.3s;
}
::-webkit-scrollbar-thumb:hover { background: rgba(124, 58, 237, 0.5); }

/* ==========================================================================
   Toast Notifications (Notifikasi Modern)
   ========================================================================== */
.toast-notification {
    position: fixed; bottom: 2rem; right: 2rem;
    padding: 1rem 1.25rem;
    border-radius: 16px;
    font-size: 0.9rem; font-weight: 600;
    z-index: 9999;
    display: flex; align-items: center; gap: 0.75rem;
    animation: slideInRight 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    backdrop-filter: blur(16px);
}
[data-theme="dark"] .toast-notification {
    background: rgba(22, 25, 34, 0.85);
    border: 1px solid rgba(255,255,255,0.08);
    color: #f8fafc;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
}
[data-theme="light"] .toast-notification {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0,0,0,0.05);
    color: #0f172a;
    box-shadow: 0 16px 32px rgba(0,0,0,0.08);
}
.toast-notification.success { border-left: 4px solid #10b981; }
.toast-notification.error { border-left: 4px solid #ef4444; }

/* ==========================================================================
   3D Perspective Card (Tampilan Mockup Keren)
   ========================================================================== */
.perspective-card {
    transform: perspective(1200px) rotateY(-6deg) rotateX(3deg);
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
}
.perspective-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.6s;
    pointer-events: none;
    z-index: 10;
}
.perspective-card:hover {
    transform: perspective(1200px) rotateY(0) rotateX(0) translateY(-5px);
}
.perspective-card:hover::before {
    opacity: 1;
}

/* ==========================================================================
   Dropdowns & UI Element Overrides
   ========================================================================== */
.dropdown-animate {
    animation: dropIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    transform-origin: top right;
}
@keyframes dropIn {
    from { opacity: 0; transform: translateY(-10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Navbar Premium Override */
[data-theme="dark"] #mainNavbar {
    background: var(--navbar-bg) !important;
    border-bottom-color: rgba(255, 255, 255, 0.05) !important;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02), 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* FAQ Details Overrides */
[data-theme="dark"] details.group {
    background: rgba(30, 35, 48, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] details.group[open] {
    background: rgba(30, 35, 48, 0.6);
    border-color: rgba(124, 58, 237, 0.4);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

/* Input Radio Overrides */
.peer:checked ~ .peer-checked\:text-brand-500 {
    color: rgb(255 255 255) !important;
    background: #7c3aed !important;
    border-color: #7c3aed !important;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

/* ==========================================================================
   Homepage Enhancements
   ========================================================================== */

/* Smooth pulse animation for status badge */
@keyframes pulse-slow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}
.animate-pulse-slow {
    animation: pulse-slow 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Perspective card hover effect */
.perspective-card {
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.perspective-card:hover {
    transform: perspective(1200px) rotateY(-4deg) rotateX(2deg) translateY(-5px);
}

/* Glass card hover transition */
.glass {
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Table responsive */
@media (max-width: 640px) {
    table, thead, tbody, th, td, tr {
        display: block;
    }
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    tr {
        margin-bottom: 1rem;
        border: 1px solid rgba(255,255,255,0.1);
        border-radius: 1rem;
    }
    td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem;
        border: none;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    td:before {
        content: attr(data-label);
        font-weight: 600;
        width: 45%;
        color: #a0aec0;
    }
    td:last-child {
        border-bottom: 0;
    }
}

/* Improve mobile spacing */
@media (max-width: 768px) {
    .glass {
        padding: 1rem;
    }
    .perspective-card {
        transform: none;
    }
    .perspective-card:hover {
        transform: translateY(-4px);
    }
}

/* Accessibility and focus outlines */
button:focus-visible, a:focus-visible {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
}

/* ==========================================================================
   Advanced Animations & Scroll Reveals
   ========================================================================== */


/* Floating animations */
@keyframes float-subtle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.animate-float-subtle {
    animation: float-subtle 5s ease-in-out infinite;
}

/* Orb pulse animation */
@keyframes orb-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.4; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.6; }
}
.animate-orb-pulse {
    animation: orb-pulse 8s ease-in-out infinite;
}

/* Ping slow animation for status indicator */
@keyframes ping-slow {
    75%, 100% { transform: scale(2); opacity: 0; }
}
.animate-ping-slow {
    animation: ping-slow 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* Pulse light (for microphone indicator) */
@keyframes pulse-light {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}
.animate-pulse-light {
    animation: pulse-light 1.5s ease-in-out infinite;
}

/* Gradient shift for hero text */
@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.animate-gradient-shift {
    background-size: 200% auto;
    animation: gradient-shift 6s ease infinite;
}

/* Subtle pulse for badge */
@keyframes pulse-subtle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
.animate-pulse-subtle {
    animation: pulse-subtle 2s ease-in-out infinite;
}

/* Table responsive (stacked on mobile) */
@media (max-width: 640px) {
    table, thead, tbody, th, td, tr {
        display: block;
    }
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    tr {
        margin-bottom: 1rem;
        border: 1px solid rgba(255,255,255,0.1);
        border-radius: 1rem;
    }
    td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem;
        border: none;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    td:before {
        content: attr(data-label);
        font-weight: 600;
        width: 45%;
        color: #a0aec0;
    }
    td:last-child {
        border-bottom: 0;
    }
}

/* Card hover effects */
.glass {
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Perspective card hover */
.perspective-card {
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.perspective-card:hover {
    transform: perspective(1200px) rotateY(-4deg) rotateX(2deg) translateY(-5px);
}

/* Button hover effects */
.btn-shimmer {
    position: relative;
    overflow: hidden;
}
.btn-shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}
.btn-shimmer:hover::after {
    left: 150%;
}

/* Touch-friendly adjustments for mobile */
@media (max-width: 768px) {
    .glass {
        padding: 1rem;
    }
    .perspective-card {
        transform: none;
    }
    .perspective-card:hover {
        transform: translateY(-4px);
    }
    button, a {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .toolbar-btn, .pin-btn, .reaction-item {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Focus outline for accessibility */
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
}

/* Additional animations for login/register pages */
@keyframes orb-pulse-slow {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.3; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.5; }
}
.animate-orb-pulse-slow {
    animation: orb-pulse-slow 12s ease-in-out infinite;
}

@keyframes float-subtle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
.animate-float-subtle {
    animation: float-subtle 4s ease-in-out infinite;
}

/* Ensure reveal-fade-up works */
.reveal-fade-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.reveal-fade-up.revealed {
    opacity: 1;
    transform: translateY(0);
}