/**
 * Zoll AI - Modern Dark Glassmorphism Styles
 * Developed by Martin Topp (mtsaga.net)
 */

:root {
    /* Primary Colors - Dark theme with orange accent */
    --primary-orange: #FF6600;
    --primary-dark: #0a0a0a;
    --secondary-dark: #1a1a1a;
    --tertiary-dark: #2a2a2a;
    
    /* Glass & Background */
    --glass-bg: rgba(26, 26, 26, 0.85);
    --glass-bg-dark: rgba(10, 10, 10, 0.9);
    --glass-header: rgba(255, 102, 0, 0.1);
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    
    /* Message Backgrounds */
    --message-user-bg: rgba(255, 102, 0, 0.15);
    --message-bot-bg: rgba(255, 102, 0, 0.08);
    
    /* Borders & Shadows */
    --border-color: rgba(255, 102, 0, 0.2);
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 25px rgba(255, 102, 0, 0.1);
    --shadow-lg: 0 20px 40px rgba(255, 102, 0, 0.15);
}

/* Main Chatbot Widget */
.tech-cyber-chatbot {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 800px;
    max-height: calc(100vh - 40px);
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: none;
    flex-direction: column;
    z-index: 9999;
    box-shadow: var(--shadow-lg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.tech-cyber-chatbot.active {
    display: flex;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
.chatbot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(255, 102, 0, 0.1), rgba(255, 102, 0, 0.05));
    backdrop-filter: blur(10px);
}

.chatbot-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.3px;
}

.chatbot-mascot {
    width: 32px;
    height: 32px;
    margin-right: 4px;
    animation: gentleFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 2px 8px rgba(0, 102, 204, 0.2));
}

@keyframes gentleFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

.chatbot-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.chatbot-close:hover {
    background: rgba(255, 102, 0, 0.1);
    color: var(--primary-orange);
}

/* Header Actions Container */
.chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Clear History Button */
.chatbot-clear {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.chatbot-clear:hover {
    background: rgba(255, 102, 0, 0.1);
    color: var(--primary-orange);
}

.chatbot-clear:active {
    transform: scale(0.95);
}

/* Messages Container */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 102, 204, 0.3);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 102, 204, 0.5);
}

/* Messages */
.chatbot-message {
    display: flex;
    animation: fadeInMessage 0.3s ease-out;
}

@keyframes fadeInMessage {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-message.chatbot-user {
    justify-content: flex-end;
}

.chatbot-message.chatbot-bot {
    justify-content: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    transition: all 0.2s;
}

.chatbot-user .message-content {
    background: linear-gradient(135deg, rgba(255, 102, 0, 0.25), rgba(255, 102, 0, 0.15));
    color: var(--text-primary);
    border: 1px solid rgba(255, 102, 0, 0.3);
    backdrop-filter: blur(10px);
}

.chatbot-bot .message-content {
    background: linear-gradient(135deg, rgba(255, 102, 0, 0.15), rgba(255, 102, 0, 0.08));
    color: var(--text-primary);
    border: 1px solid rgba(255, 102, 0, 0.2);
    backdrop-filter: blur(8px);
}

.chatbot-bot .message-content a {
    color: var(--primary-orange);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid var(--primary-orange);
}

.chatbot-bot .message-content a:hover {
    color: #ff8833;
    border-bottom-color: #ff8833;
}

/* Markdown formatting styles */
.chatbot-bot .message-content strong {
    font-weight: 600;
    color: var(--primary-orange);
}

.chatbot-bot .message-content em {
    font-style: italic;
    color: #ffcc99;
}

.chatbot-bot .message-content h3,
.chatbot-bot .message-content h4 {
    margin: 12px 0 8px 0;
    font-weight: 600;
    color: var(--primary-orange);
    font-size: 15px;
    line-height: 1.4;
}

.chatbot-bot .message-content h3:first-child,
.chatbot-bot .message-content h4:first-child {
    margin-top: 0;
}

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

.chatbot-bot .message-content li {
    margin: 6px 0;
    line-height: 1.5;
    list-style: none;
}

.chatbot-bot .message-content ul li {
    list-style-type: disc;
}

/* Typing Indicator */
.typing-indicator {
    justify-content: flex-start !important;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(255, 102, 0, 0.15), rgba(255, 102, 0, 0.08));
    border: 1px solid rgba(255, 102, 0, 0.2);
    border-radius: 12px;
    backdrop-filter: blur(8px);
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-orange);
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.4;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-10px);
    }
}

/* Input Container */
.chatbot-input-container {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(255, 102, 0, 0.08), rgba(255, 102, 0, 0.05));
    backdrop-filter: blur(10px);
    align-items: center;
}

.chatbot-lucky {
    background: rgba(255, 102, 0, 0.15);
    border: 1px solid rgba(255, 102, 0, 0.2);
    border-radius: 10px;
    color: var(--text-primary);
    padding: 10px 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s;
    backdrop-filter: blur(5px);
    min-width: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-lucky:hover {
    background: rgba(255, 102, 0, 0.25);
    border-color: rgba(255, 102, 0, 0.4);
    box-shadow: 0 0 8px rgba(255, 102, 0, 0.2);
    transform: scale(1.05);
}

.chatbot-lucky:active {
    transform: scale(0.98);
}

.chatbot-lucky i {
    font-size: 16px;
    color: currentColor;
}

.lucky-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.lucky-icon i {
    position: absolute;
}

.lucky-icon i:not(.fas) {
    display: none;
}

/* Show fallback emoji if FontAwesome doesn't load */
.icon-fallback {
    display: none;
    font-size: 16px;
}

/* If FontAwesome fails to load, show emoji */
body.no-fontawesome .icon-fallback,
.lucky-icon i.fas:not([class*="fa-"]) ~ .icon-fallback {
    display: inline;
}

body.no-fontawesome .lucky-icon i,
.lucky-icon i.fas:not([class*="fa-"])) {
    display: none !important;
}

.chatbot-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    padding: 10px 14px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.chatbot-input:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 102, 0, 0.4);
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.1);
}

.chatbot-input::placeholder {
    color: var(--text-muted);
}

.chatbot-send {
    background: linear-gradient(135deg, rgba(255, 102, 0, 0.85), rgba(255, 102, 0, 0.75));
    border: 1px solid rgba(255, 102, 0, 0.3);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s;
    backdrop-filter: blur(5px);
}

.chatbot-send:hover:not(:disabled) {
    background: linear-gradient(135deg, #FF6600, #ff8833);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.chatbot-send:active:not(:disabled) {
    transform: translateY(0);
}

.chatbot-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Footer */
.chatbot-footer {
    padding: 10px 12px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
    background: linear-gradient(135deg, rgba(255, 102, 0, 0.05), rgba(255, 102, 0, 0.03));
    backdrop-filter: blur(5px);
}

.chatbot-footer small {
    display: block;
}

/* Toggle Button */
.chatbot-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, rgba(255, 102, 0, 0.9), rgba(255, 102, 0, 0.8));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 102, 0, 0.3);
    border-radius: 16px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow-md);
    animation: floatUp 3s ease-in-out infinite;
}

.chatbot-toggle:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, #FF6600, #ff8833);
}

.chatbot-toggle:active {
    transform: translateY(-2px);
}

.chatbot-toggle.hidden {
    display: none;
}

.toggle-mascot {
    width: 56px;
    height: 56px;
    animation: gentleFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.15));
}

@keyframes floatUp {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

/* Responsive */
@media (max-width: 480px) {
    .tech-cyber-chatbot {
        width: calc(100vw - 20px);
        height: 70vh;
        max-height: 500px;
        border-radius: 16px 16px 0 0;
        bottom: 0;
        left: 10px;
        right: auto;
    }

    .chatbot-toggle {
        bottom: 30px;
        left: 20px;
        right: auto;
        transform: none;
    }

    .chatbot-toggle:hover {
        transform: translateY(-4px);
    }

    .message-content {
        max-width: 90%;
    }
}

@media (max-width: 768px) {
    .tech-cyber-chatbot {
        width: calc(100vw - 20px);
        left: 10px;
        right: auto;
    }
}

/* Print styles */
@media print {
    .tech-cyber-chatbot,
    .chatbot-toggle {
        display: none !important;
    }
}
