/* ============================================
   CHAT MODAL STYLES
   ============================================ */

#chat-modal .modal-content {
    background: var(--bg-panel, rgba(10, 14, 20, 0.95));
    border: 1px solid var(--border-primary, #1a3a4a);
    border-left: 3px solid var(--accent-cyan, #00d4aa);
    color: var(--text-primary, #e0f0e8);
    display: flex;
    flex-direction: column;
    height: 70vh; /* Desktop: angemessene Höhe */
    max-height: 600px;
    padding: 0;
    box-sizing: border-box;
}

/* iOS Safari spezifische Fixes */
@supports (-webkit-touch-callout: none) {
    #chat-modal .modal-content {
        height: 70dvh; /* iOS: volle Höhe */
    }
    
    @supports (height: -webkit-fill-available) {
        #chat-modal .modal-content {
            height: calc(-webkit-fill-available * 0.7);
            max-height: calc(-webkit-fill-available * 0.7);
        }
    }
}

#chat-modal h4 {
    font-family: 'Orbitron', 'Share Tech Mono', monospace;
    color: var(--text-accent, #00ffcc);
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 16px;
    margin: 0;
    border-bottom: 1px solid var(--border-primary, #1a3a4a);
    background: linear-gradient(180deg, rgba(0, 40, 50, 0.5) 0%, transparent 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

#chat-modal h4 span {
    flex: 1;
}

.chat-close-button {
    background: transparent;
    border: 1px solid var(--border-primary, #1a3a4a);
    border-left: 2px solid var(--accent-cyan, #00d4aa);
    color: var(--text-accent, #00ffcc);
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    line-height: 1;
}

.chat-close-button:hover {
    background: rgba(0, 60, 50, 0.4);
    border-color: var(--accent-cyan, #00d4aa);
    box-shadow: 0 0 10px rgba(0, 212, 170, 0.4);
    transform: scale(1.1);
}

.chat-close-button:active {
    transform: scale(0.95);
    box-shadow: 0 0 5px rgba(0, 212, 170, 0.3);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

.chat-message {
    padding: 10px 14px;
    background: rgba(15, 25, 35, 0.4);
    border: 1px solid var(--border-primary, #1a3a4a);
    border-left: 3px solid var(--accent-cyan, #00d4aa);
    border-radius: 0;
    transition: all 0.2s ease;
}

.chat-message:hover {
    background: rgba(0, 50, 60, 0.4);
    border-color: var(--accent-cyan, #00d4aa);
}

.chat-message.own-message {
    background: rgba(0, 60, 50, 0.4);
    border-left-color: var(--accent-green, #00ff88);
    margin-left: auto;
    max-width: 80%;
}

.chat-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    gap: 10px;
}

.chat-username {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    color: var(--accent-cyan, #00d4aa);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chat-message.own-message .chat-username {
    color: var(--accent-green, #00ff88);
}

.chat-time {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-secondary, #8ba89e);
    opacity: 0.7;
    flex-shrink: 0;
}

.chat-message-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-primary, #e0f0e8);
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.chat-input-container {
    display: flex;
    gap: 10px;
    padding: 16px;
    border-top: 1px solid var(--border-primary, #1a3a4a);
    background: rgba(10, 14, 20, 0.5);
}

#chat-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(15, 25, 35, 0.6);
    border: 1px solid var(--border-primary, #1a3a4a);
    border-left: 2px solid var(--accent-cyan, #00d4aa);
    color: var(--text-primary, #e0f0e8);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.85rem;
    outline: none;
    transition: all 0.2s ease;
}

#chat-input:focus {
    border-color: var(--accent-cyan, #00d4aa);
    box-shadow: 0 0 10px rgba(0, 212, 170, 0.3);
}

#chat-input::placeholder {
    color: var(--text-secondary, #8ba89e);
    opacity: 0.6;
}

#chat-send {
    min-width: 120px;
    padding: 12px 24px;
    background: linear-gradient(180deg, rgba(0, 60, 50, 0.9) 0%, rgba(0, 40, 35, 0.95) 100%);
    border: 1px solid var(--accent-cyan, #00d4aa);
    border-left: 3px solid var(--accent-cyan, #00d4aa);
    color: var(--text-accent, #00ffcc);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 8px rgba(0, 212, 170, 0.3);
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: auto;
    line-height: 1;
    flex-shrink: 0;
}

#chat-send:hover {
    background: linear-gradient(180deg, rgba(0, 80, 70, 0.9) 0%, rgba(0, 60, 50, 0.95) 100%);
    box-shadow: 0 0 15px rgba(0, 212, 170, 0.5);
    transform: translateY(-1px);
    border-color: var(--accent-cyan, #00d4aa);
}

#chat-send:active {
    transform: translateY(0);
    box-shadow: 0 0 8px rgba(0, 212, 170, 0.3);
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(10, 20, 30, 0.5);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 170, 0.3);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 170, 0.5);
}

/* Chat Notification Badge */
#tool-chat {
    position: relative;
}

.chat-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent-cyan, #00d4aa);
    color: var(--bg-primary, #0a0e14);
    border: 1.5px solid var(--accent-cyan, #00d4aa);
    border-radius: 10px;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 0 5px;
    box-shadow: 
        0 0 10px rgba(0, 212, 170, 0.6),
        0 0 15px rgba(0, 212, 170, 0.4);
    animation: pulseBadge 2s ease-in-out infinite;
    z-index: 1000;
    text-shadow: none;
    line-height: 1;
}

.chat-notification-badge.icon-only {
    min-width: 20px;
    width: 20px;
    height: 20px;
    padding: 0;
    font-size: 0.9rem;
    border-radius: 10px;
}

@keyframes pulseBadge {
    0%, 100% {
        box-shadow: 
            0 0 10px rgba(0, 212, 170, 0.6),
            0 0 15px rgba(0, 212, 170, 0.4);
    }
    50% {
        box-shadow: 
            0 0 15px rgba(0, 212, 170, 0.9),
            0 0 20px rgba(0, 212, 170, 0.6);
    }
}

/* Mobile */
@media (max-width: 600px) {
    #chat-modal {
        max-width: calc(100vw - 16px);
        margin: 0 8px;
        max-height: 100dvh;
    }
    
    #chat-modal .modal-content {
        height: 85dvh;
        max-height: 85dvh;
        padding: 0;
        box-sizing: border-box;
    }
    
    /* iOS Safari spezifische Fixes */
    @supports (-webkit-touch-callout: none) {
        #chat-modal {
            max-height: -webkit-fill-available;
        }
        
        #chat-modal .modal-content {
            height: calc(-webkit-fill-available - 100px) !important;
            max-height: calc(-webkit-fill-available - 100px) !important;
        }
    }
    
    #chat-modal h4 {
        padding: 12px 16px;
        font-size: 0.85rem;
    }
    
    .chat-close-button {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }
    
    .chat-messages {
        padding: 12px;
        gap: 10px;
    }
    
    .chat-message {
        padding: 8px 12px;
    }
    
    .chat-message.own-message {
        max-width: 90%;
    }
    
    .chat-message-header {
        margin-bottom: 4px;
    }
    
    .chat-username {
        font-size: 0.7rem;
    }
    
    .chat-time {
        font-size: 0.65rem;
    }
    
    .chat-message-text {
        font-size: 0.8rem;
    }
    
    .chat-input-container {
        flex-direction: column;
        padding: 12px;
        gap: 8px;
    }
    
    #chat-input {
        padding: 10px 12px;
        font-size: 0.8rem;
    }
    
    #chat-send {
        width: 100%;
        padding: 10px 16px;
        font-size: 0.8rem;
    }
    
    .chat-notification-badge {
        min-width: 18px;
        height: 18px;
        font-size: 0.65rem;
        top: -4px;
        right: -4px;
        border-width: 1.5px;
        border-radius: 9px;
    }
    
    .chat-notification-badge.icon-only {
        min-width: 18px;
        width: 18px;
        height: 18px;
        font-size: 0.85rem;
    }
}

