/* ancientfit-frontend/css/ai.css */

/* AI Widget Container */
#ai-search-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.15),
        0 6px 20px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    width: 380px;
    max-width: 90vw;
    max-height: 70vh;
    display: none;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.4);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: all 0.3s ease;
}

/* AI Widget Header */
.ai-header {
    background: linear-gradient(135deg, 
        rgba(44, 62, 80, 0.95) 0%, 
        rgba(74, 100, 145, 0.95) 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    min-height: 60px;
}

.ai-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.ai-icon-container {
    background: rgba(212, 175, 55, 0.2);
    min-width: 40px;
    min-height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(212, 175, 55, 0.3);
    overflow: hidden;
    position: relative;
}

#ai-header-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 50%;
    display: block;
}

.ai-title {
    flex: 1;
    min-width: 0;
}

.ai-title h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.ai-subtitle {
    font-size: 11px;
    opacity: 0.85;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#close-ai {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-left: 10px;
}

#close-ai:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg) scale(1.1);
}

/* AI Widget Body */
.ai-body {
    padding: 20px;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#ai-search-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid rgba(44, 62, 80, 0.15);
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 15px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s;
    box-sizing: border-box;
}

#ai-search-input:focus {
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15), inset 0 2px 8px rgba(0, 0, 0, 0.04);
    outline: none;
}

#ai-results {
    flex: 1;
    overflow-y: auto;
    margin-top: 5px;
    padding-right: 5px;
}

.ai-footer {
    margin-top: 16px;
    font-size: 11px;
    color: #666;
    text-align: center;
    padding-top: 14px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.ai-footer-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-footer-icon {
    color: #d4af37;
    font-size: 13px;
}

.ai-footer-badge {
    background: rgba(212, 175, 55, 0.12);
    color: #d4af37;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* AI Toggle Button */
#ai-toggle {
    position: fixed;
    bottom: 25px;
    left: 25px;
    z-index: 999;
    background: linear-gradient(
        135deg,
        rgba(44, 62, 80, 0.92) 0%,
        rgba(74, 100, 145, 0.85) 50%,
        rgba(44, 62, 80, 0.78) 100%
    );
    color: white;
    border: none;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    cursor: pointer;
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.25),
        0 6px 20px rgba(0, 0, 0, 0.15),
        inset 0 2px 0 rgba(255, 255, 255, 0.35),
        inset 0 -2px 0 rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(12px);
    border: 2px solid rgba(255, 255, 255, 0.25);
    animation: pulse-glow 3s infinite;
    padding: 0;
    overflow: hidden;
}

.ai-toggle-glow {
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(212, 175, 55, 0.25),
        transparent
    );
    border-radius: 50%;
    animation: rotate 10s linear infinite;
    z-index: 1;
}

#ai-toggle-icon {
    position: relative;
    z-index: 2;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border: 2px solid rgba(212, 175, 55, 0.3);
}

#ai-button-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    transition: transform 0.3s;
    display: block;
}

/* Results Styling */
.ai-result-header {
    font-size: 13px;
    color: #666;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(212, 175, 55, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.ai-result-count {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-result-badge {
    background: rgba(212, 175, 55, 0.12);
    color: #d4af37;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.ai-result-item {
    padding: 18px;
    margin-bottom: 14px;
    background: linear-gradient(
        135deg,
        rgba(249, 249, 249, 0.95) 0%,
        rgba(255, 255, 255, 0.98) 100%
    );
    border-radius: 14px;
    border-left: 5px solid #d4af37;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.ai-result-number {
    position: absolute;
    top: 0;
    right: 0;
    width: 42px;
    height: 42px;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 0 14px 0 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #d4af37;
    font-weight: 800;
    border-left: 1px solid rgba(212, 175, 55, 0.2);
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.ai-result-title {
    font-weight: 800;
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 16px;
    padding-right: 45px;
    line-height: 1.3;
}

.ai-result-snippet {
    font-size: 14px;
    color: #555;
    margin-bottom: 14px;
    line-height: 1.5;
}

.ai-keywords-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.ai-keyword {
    background: rgba(44, 62, 80, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: #2c3e50;
    font-weight: 600;
    border: 1px solid rgba(44, 62, 80, 0.1);
}

.ai-schedule-link {
    font-size: 13px;
    color: #2c3e50;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.12), rgba(212, 175, 55, 0.08));
    padding: 12px 18px;
    border-radius: 10px;
    transition: all 0.3s;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.ai-schedule-link:hover {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(212, 175, 55, 0.15));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.15);
}

.ai-link-icon {
    color: #d4af37;
    font-size: 16px;
}

.ai-link-arrow {
    color: #d4af37;
    font-size: 18px;
}

/* Loading State */
.ai-loading {
    padding: 40px 20px;
    text-align: center;
    color: #666;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.ai-loading-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(212, 175, 55, 0.2);
    border-top-color: #d4af37;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

/* No Results State */
.ai-no-results {
    padding: 40px 20px;
    text-align: center;
    color: #666;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.ai-no-results-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    border: 2px solid rgba(212, 175, 55, 0.2);
}

.ai-schedule-card {
    width: 100%;
    max-width: 320px;
    margin-bottom: 25px;
    text-decoration: none;
}

.ai-schedule-card-content {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(212, 175, 55, 0.1));
    padding: 18px;
    border-radius: 14px;
    font-size: 13px;
    color: #2c3e50;
    border: 1px solid rgba(212, 175, 55, 0.25);
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.ai-schedule-card-content:hover {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.25), rgba(212, 175, 55, 0.2));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.15);
}

.ai-suggestions-container {
    background: rgba(44, 62, 80, 0.04);
    padding: 18px;
    border-radius: 14px;
    font-size: 13px;
    color: #666;
    width: 100%;
    max-width: 320px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.ai-suggestion {
    cursor: pointer;
    padding: 8px 16px;
    background: rgba(212, 175, 55, 0.12);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #2c3e50;
    border: 1px solid rgba(212, 175, 55, 0.2);
    transition: all 0.2s;
}

.ai-suggestion:hover {
    background: rgba(212, 175, 55, 0.2);
    transform: translateY(-2px);
}

/* Error State */
.ai-error {
    padding: 40px 20px;
    text-align: center;
    color: #d9534f;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Animations */
@keyframes pulse-glow {
    0%, 100% { 
        box-shadow: 
            0 12px 40px rgba(0, 0, 0, 0.25),
            0 6px 20px rgba(0, 0, 0, 0.15),
            inset 0 2px 0 rgba(255, 255, 255, 0.35),
            inset 0 -2px 0 rgba(0, 0, 0, 0.2);
    }
    50% { 
        box-shadow: 
            0 12px 50px rgba(212, 175, 55, 0.35),
            0 8px 30px rgba(212, 175, 55, 0.25),
            inset 0 2px 0 rgba(255, 255, 255, 0.4),
            inset 0 -2px 0 rgba(0, 0, 0, 0.2);
    }
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Hover Effects */
#ai-toggle:hover {
    transform: scale(1.12) translateY(-3px);
    box-shadow: 
        0 16px 50px rgba(212, 175, 55, 0.4),
        0 10px 30px rgba(212, 175, 55, 0.3),
        inset 0 2px 0 rgba(255, 255, 255, 0.45),
        inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

#ai-toggle:hover #ai-button-icon {
    transform: scale(1.1) rotate(5deg);
}

#ai-toggle:active {
    transform: scale(0.96) translateY(1px);
    transition: transform 0.1s;
}

/* Scrollbar Styling */
#ai-results::-webkit-scrollbar {
    width: 8px;
}

#ai-results::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.04);
    border-radius: 4px;
}

#ai-results::-webkit-scrollbar-thumb {
    background: rgba(44, 62, 80, 0.2);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

#ai-results::-webkit-scrollbar-thumb:hover {
    background: rgba(44, 62, 80, 0.35);
}

/* Responsive Media Queries */
@media (max-width: 768px) {
    #ai-search-widget {
        width: 92vw;
        left: 4vw;
        right: 4vw;
        bottom: 15px;
        max-height: 75vh;
        border-radius: 20px;
    }
    
    #ai-toggle {
        width: 65px;
        height: 65px;
        bottom: 20px;
        left: 20px;
    }
    
    #ai-toggle-icon {
        width: 46px;
        height: 46px;
    }
    
    .ai-header {
        padding: 14px 16px;
        min-height: 55px;
    }
    
    #ai-search-input {
        padding: 12px 14px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    #ai-search-widget {
        width: 95vw;
        left: 2.5vw;
        right: 2.5vw;
        bottom: 10px;
        max-height: 80vh;
    }
    
    #ai-toggle {
        width: 60px;
        height: 60px;
        bottom: 15px;
        left: 15px;
    }
    
    #ai-toggle-icon {
        width: 42px;
        height: 42px;
    }
}

@media (max-height: 600px) {
    #ai-search-widget {
        max-height: 85vh;
    }
    
    #ai-results {
        max-height: 45vh;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    #ai-toggle:hover {
        transform: none;
    }
    
    #ai-toggle:active {
        transform: scale(0.95);
    }
    
    #ai-search-input, 
    #close-ai, 
    .ai-suggestion, 
    .ai-schedule-link {
        min-height: 44px;
    }
}