/**
 * LiveWorldAI - Custom Additional Styles
 */

/* ===== AI PAGE SPECIFIC ===== */
.ai-page .ai-container {
    min-height: 70vh;
}

.ai-page .ai-messages {
    max-height: 500px;
    overflow-y: auto;
    padding-right: 8px;
}

/* Typing indicator dots animation */
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

.ai-message.typing-indicator .ai-message-content span {
    animation: typingBounce 1.4s ease-in-out infinite;
}

.ai-message.typing-indicator .ai-message-content span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-message.typing-indicator .ai-message-content span:nth-child(3) {
    animation-delay: 0.4s;
}

/* ===== EVENT CARD ENHANCEMENTS ===== */
.event-card {
    position: relative;
    cursor: default;
}

.event-card .event-card-title {
    transition: color 0.3s ease;
}

.event-card:hover .event-card-title {
    color: var(--color-primary);
}

/* ===== AUTH PAGE BACKGROUND ===== */
.auth-section {
    position: relative;
}

.auth-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(0, 212, 255, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(124, 58, 237, 0.05) 0%, transparent 50%);
    z-index: 0;
}

.auth-section > * {
    position: relative;
    z-index: 1;
}

/* ===== FORM ENHANCEMENTS ===== */
.form-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1), 0 0 20px rgba(0, 212, 255, 0.05);
}

/* ===== PREFERENCE CARD STATES ===== */
.preference-card {
    user-select: none;
}

.preference-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.preference-card .toggle-switch {
    pointer-events: none;
}

/* ===== DASHBOARD NAV ACTIVE STATE ===== */
.dashboard-nav a.active {
    background: rgba(0, 212, 255, 0.08);
    color: var(--color-primary);
}

/* ===== SCROLLBAR FOR AI MESSAGES ===== */
.ai-messages::-webkit-scrollbar {
    width: 4px;
}

.ai-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai-messages::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 2px;
}

/* ===== LOADING PLACEHOLDER ===== */
.loading-placeholder {
    pointer-events: none;
}

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

.loading-skeleton {
    background: linear-gradient(
        90deg,
        var(--color-bg-card) 25%,
        rgba(0, 212, 255, 0.05) 50%,
        var(--color-bg-card) 75%
    );
    background-size: 200% 100%;
    animation: shimmer-load 1.5s infinite;
}

/* ===== RESPONSIVE IMPROVEMENTS ===== */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem !important;
    }
    
    .hero-stats {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    .map-container {
        height: 50vh !important;
        min-height: 300px;
    }
    
    .ai-container {
        grid-template-columns: 1fr !important;
    }
    
    .ai-sidebar {
        border-left: none !important;
        border-top: 1px solid var(--color-border);
    }
    
    .stats-row {
        grid-template-columns: 1fr 1fr !important;
    }
    
    .preferences-grid {
        grid-template-columns: 1fr !important;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }
    
    .auth-card {
        padding: 24px !important;
    }
    
    #register-form [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

/* ===== HIGH CONTRAST MODE SUPPORT ===== */
@media (prefers-contrast: high) {
    :root {
        --color-border: #555;
        --color-text-muted: #aaa;
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .site-header,
    .site-footer,
    .scroll-top,
    .ai-input-area,
    .map-controls,
    .event-filters,
    .dashboard-sidebar,
    .btn {
        display: none !important;
    }
    
    .map-container {
        height: 400px !important;
        page-break-inside: avoid;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .event-card {
        break-inside: avoid;
        border: 1px solid #ccc;
    }
}

/* ===== SELECTION COLORS ===== */
::selection {
    background: rgba(0, 212, 255, 0.3);
    color: #fff;
}

::-moz-selection {
    background: rgba(0, 212, 255, 0.3);
    color: #fff;
}

/* ===== FOCUS STYLES ===== */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ===== EMPTY STATES ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 8px;
    color: var(--color-text);
}

/* ===== CODE BLOCKS IN AI MESSAGES ===== */
.ai-message-content pre {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin: 12px 0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.ai-message-content code {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

.ai-message-content ul,
.ai-message-content ol {
    padding-left: 20px;
    margin: 8px 0;
}

.ai-message-content li {
    margin-bottom: 4px;
}

.ai-message-content strong {
    color: var(--color-primary);
}

/* ===== SCROLL INDICATOR ===== */
.scroll-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
    40% { transform: translateX(-50%) translateY(-10px); }
    60% { transform: translateX(-50%) translateY(-5px); }
}

/* ===== MAP FULLSCREEN ===== */
.map-container:fullscreen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
}

.map-container:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
}

/* ===== PULSE ANIMATION FOR LIVE DOT ===== */
@keyframes livePulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.live-dot {
    animation: livePulse 2s infinite;
}

/* ===== SECTION TOGGLE ANIMATIONS ===== */
.dashboard-section-content {
    animation: fadeIn 0.3s ease;
}

.dashboard-section-content.hidden {
    display: none;
}

/* ===== PREFERENCE CARD IMPROVEMENTS ===== */
.preference-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.preference-card.active:hover {
    border-color: var(--color-primary);
}
