:root {
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    --lumi-glow: 0 0 20px rgba(167, 139, 250, 0.5);
}

body {
    background: linear-gradient(-45deg, #0f172a, #1e1b4b, #312e81, #1e293b);
    background-size: 400% 400%;
    animation: gradient 20s ease infinite;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', sans-serif;
    color: white;
    overflow-x: hidden;
}

@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    box-shadow: var(--glass-shadow);
    transition: all 0.3s ease;
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

/* Enhanced Search Input */
.search-input {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.1rem;
}

.search-input:focus {
    background: rgba(255, 255, 255, 0.12);
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

/* FIXED: Browser Dropdown Styling */
#engine-dropdown-menu {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1000;
}

#engine-dropdown-menu:not(.hidden) {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

@keyframes dropdownEnter {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes dropdownExit {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
}

/* Modal Styling */
.modal-overlay {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: none;
    z-index: 1000;
}

.modal-overlay:not(.hidden) {
    display: flex !important;
    animation: fadeIn 0.3s ease;
}

.modal-overlay .glass-panel {
    animation: slideUp 0.3s ease;
    max-width: 90%;
    max-height: 90vh;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.coin-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.human-active {
    color: #34d399;
    text-shadow: 0 0 10px rgba(52, 211, 153, 0.5);
}

/* Transitions for views */
.view-transition {
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.hidden-view {
    display: none;
    opacity: 0;
    pointer-events: none;
}

/* Flash Animations */
@keyframes flash-green {
    0% { color: #4ade80; text-shadow: 0 0 10px rgba(74, 222, 128, 0.5); }
    100% { color: inherit; text-shadow: none; }
}
@keyframes flash-red {
    0% { color: #f87171; text-shadow: 0 0 10px rgba(248, 113, 113, 0.5); }
    100% { color: inherit; text-shadow: none; }
}
.flash-up { animation: flash-green 1s ease-out; }
.flash-down { animation: flash-red 1s ease-out; }

/* Weather Animations */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}
.weather-icon-float { animation: float 6s ease-in-out infinite; }

/* Lumi Chat Animations */
.lumi-panel {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 350px;
    height: 500px;
    z-index: 60;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.lumi-active {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.lumi-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 61;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
}

.lumi-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.5);
}

.lumi-message {
    max-width: 85%;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 1.25rem;
    font-size: 0.85rem;
    line-height: 1.4;
    animation: messagePop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    word-wrap: break-word;
}

.lumi-message.user {
    background: rgba(255, 255, 255, 0.1);
    align-self: flex-end;
    border-bottom-right-radius: 0.25rem;
}

.lumi-message.bot {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(79, 70, 229, 0.2));
    border: 1px solid rgba(124, 58, 237, 0.1);
    align-self: flex-start;
    border-bottom-left-radius: 0.25rem;
}

@keyframes messagePop {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.typing-dot {
    animation: typing 1.4s infinite ease-in-out both;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    display: inline-block;
    margin: 0 1px;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Voice Animation */
.voice-active {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.3), rgba(79, 70, 229, 0.3));
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(124, 58, 237, 0); }
    100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0); }
}

/* Timer Animations */
@keyframes timer-pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.timer-active {
    animation: timer-pulse 2s ease-in-out infinite;
}

.gradient-text {
    background: linear-gradient(135deg, #34d399, #22d3ee, #818cf8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 2px 20px rgba(52, 211, 153, 0.2);
}

/* Task Styles */
.task-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.2s ease;
    cursor: pointer;
}

.task-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
}

.task-item.completed {
    opacity: 0.5;
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: rgba(255, 255, 255, 0.4);
}

.task-checkbox {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.task-checkbox.checked {
    background: #34d399;
    border-color: #34d399;
}

.task-checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 10px;
}

.task-text {
    flex: 1;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
}

.task-delete {
    opacity: 0;
    color: rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
    cursor: pointer;
    padding: 2px;
}

.task-item:hover .task-delete {
    opacity: 1;
}

.task-delete:hover {
    color: #f87171;
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 2px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Focus Mode Dropdown */
#timer-mode-dropdown {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    min-width: 200px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Button Glow Effects */
.btn-glow {
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.3);
}

.btn-glow:hover {
    box-shadow: 0 0 30px rgba(52, 211, 153, 0.5);
}

/* Loading Animation */
@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.shimmer {
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0) 0%, 
        rgba(255, 255, 255, 0.05) 50%, 
        rgba(255, 255, 255, 0) 100%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.2);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    animation: slideIn 0.3s ease-out;
    z-index: 1000;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Human Filter Toggle */
#human-btn div:first-child {
    transition: all 0.3s ease;
}

#human-btn #human-indicator {
    transition: all 0.3s ease;
    transform: translateX(0);
}

#human-btn #human-indicator.translate-x-8 {
    transform: translateX(32px);
}

/* Quick Search Buttons */
.quick-search-btn {
    transition: all 0.3s ease;
    transform: translateY(0);
}

.quick-search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Timer Custom Input */
#custom-time-input {
    font-variant-numeric: tabular-nums;
}

#custom-time-input::-webkit-inner-spin-button,
#custom-time-input::-webkit-outer-spin-button {
    opacity: 0.5;
    height: 30px;
}

/* Enhanced Human Filter Section */
#human-filter-section {
    padding: 16px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* AI Status Indicator */
#ai-status-indicator {
    transition: all 0.3s ease;
}

/* Settings Modal Specific */
#settings-modal .glass-panel {
    max-width: 400px;
}

/* API Key Input */
#gemini-api-key {
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .search-input {
        font-size: 1rem;
        height: 56px;
    }
    
    #timer-display {
        font-size: 3.5rem;
    }
    
    .lumi-panel {
        width: 90vw;
        height: 60vh;
        bottom: 1rem;
        right: 1rem;
    }
    
    .lumi-btn {
        bottom: 1rem;
        right: 1rem;
    }
    
    .modal-overlay {
        padding: 1rem;
    }
    
    .glass-panel {
        border-radius: 20px;
    }
    
    /* Browser dropdown on mobile */
    #engine-dropdown-menu {
        position: fixed;
        top: auto;
        bottom: 100px;
        left: 50%;
        transform: translateX(-50%) scale(0.95);
        width: 90vw;
        max-width: 300px;
    }
    
    /* Settings modal on mobile */
    #settings-modal .glass-panel {
        width: 95vw;
        max-width: 95vw;
    }
    
    /* Enhanced Human Filter for mobile */
    #human-filter-section {
        padding: 12px;
    }
    
    #human-btn {
        transform: scale(0.9);
    }
    
    /* Task item adjustments for mobile */
    .task-item {
        padding: 8px 10px;
    }
    
    .task-text {
        font-size: 12px;
    }
}

/* Ensure modal content is scrollable */
#full-weather-content,
#market-detail-view,
#market-list-view > div:last-child {
    max-height: calc(90vh - 120px);
    overflow-y: auto;
}

/* Human filter toggle active state */
#human-btn.active #human-indicator {
    transform: translateX(32px);
    background: #34d399;
    box-shadow: 0 0 15px rgba(52, 211, 153, 0.5);
}

/* Enhanced search section */
.w-full.text-left h1 {
    background: linear-gradient(135deg, #ffffff 0%, #d4d4d4 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

.w-full.text-left p {
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Task widget in main area */
#task-list {
    max-height: 200px;
}

/* Timer controls spacing */
.timer-controls {
    gap: 12px;
}

/* API Key Test Button */
#api-test-btn {
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}

#api-test-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Link styles in chat */
.lumi-message a {
    color: #60a5fa;
    text-decoration: underline;
}

.lumi-message a:hover {
    color: #93c5fd;
}

/* Code blocks in chat */
.lumi-message pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 5px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.lumi-message code {
    font-family: 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Lists in chat */
.lumi-message ul, .lumi-message ol {
    padding-left: 20px;
    margin: 5px 0;
}

.lumi-message li {
    margin: 3px 0;
}