/**
 * Ahmad Bot Styles
 * Dark sovereign theme (navy/cyan/gold)
 * Launcher, panel, messages, animations
 */

/* Root variables */
:root {
    --ahmad-primary: #0a0e27;
    --ahmad-secondary: #1a1a2e;
    --ahmad-tertiary: #16213e;
    --ahmad-cyan: #00d9ff;
    --ahmad-gold: #ffd700;
    --ahmad-text-primary: #e0e0e0;
    --ahmad-text-secondary: #a0a0a0;
    --ahmad-error: #ef4444;
    --ahmad-success: #10b981;
    --ahmad-accent: #00d9ff;
}

/* Launcher Button (Fixed Bottom Right) */
#jit-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
}

#jit-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ahmad-secondary) 0%, var(--ahmad-tertiary) 100%);
    border: 2px solid var(--ahmad-cyan);
    color: var(--ahmad-cyan);
    font-size: 28px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 217, 255, 0.2);
    transition: all 0.3s ease;
    user-select: none;
    font-family: 'Segoe UI Symbol', 'Apple Color Emoji', sans-serif;
}

#jit-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(0, 217, 255, 0.4);
    border-color: var(--ahmad-gold);
    color: var(--ahmad-gold);
}

#jit-toggle.active {
    background: linear-gradient(135deg, var(--ahmad-cyan), #00a8cc);
    color: var(--ahmad-primary);
    animation: ahmad-rotation 0.6s ease;
}

#jit-toggle.loading {
    animation: ahmad-loading-pulse 1.5s ease-in-out infinite;
}

/* Launcher animations */
@keyframes ahmad-rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(180deg); }
}

@keyframes ahmad-loading-pulse {
    0% {
        box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
    }
    50% {
        box-shadow: 0 6px 30px rgba(59, 130, 246, 0.8);
    }
    100% {
        box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
    }
}

/* Panel Container */
#jit-panel {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 430px;
    height: 650px;
    max-width: 95vw;
    max-height: 85vh;
    background: linear-gradient(180deg, var(--ahmad-secondary) 0%, var(--ahmad-primary) 100%);
    border: 1px solid var(--ahmad-cyan);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 217, 255, 0.3), 0 0 20px rgba(0, 217, 255, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#jit-panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9) translateY(20px);
}

#jit-panel.minimized {
    height: 50px;
}

#jit-panel.minimized #jit-messages,
#jit-panel.minimized .jit-composer {
    display: none;
}

/* Panel Header */
.jit-header {
    padding: 16px;
    border-bottom: 1px solid rgba(0, 217, 255, 0.2);
    cursor: grab;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.jit-header:active {
    cursor: grabbing;
}

.jit-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--ahmad-text-primary);
    letter-spacing: 0.5px;
}

.jit-status-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.jit-status-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 3px;
    letter-spacing: 0.5px;
    min-width: 50px;
    text-align: center;
}

.jit-status-offline {
    background: rgba(107, 114, 128, 0.3);
    color: #a0a0a0;
}

.jit-status-loading {
    background: rgba(59, 130, 246, 0.3);
    color: #60a5fa;
    animation: ahmad-pulse-badge 1.5s ease-in-out infinite;
}

.jit-status-ready {
    background: rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.jit-status-generating {
    background: rgba(0, 217, 255, 0.3);
    color: #00d9ff;
    animation: ahmad-pulse-badge 1s ease-in-out infinite;
}

.jit-status-error {
    background: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

@keyframes ahmad-pulse-badge {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Control buttons */
.jit-controls {
    display: flex;
    gap: 6px;
}

.jit-control-btn {
    background: rgba(0, 217, 255, 0.1);
    border: 1px solid rgba(0, 217, 255, 0.3);
    color: var(--ahmad-cyan);
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.jit-control-btn:hover {
    background: rgba(0, 217, 255, 0.2);
    border-color: var(--ahmad-gold);
    color: var(--ahmad-gold);
}

.jit-control-btn:active {
    transform: scale(0.9);
}

/* Messages container */
#jit-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

#jit-messages::-webkit-scrollbar {
    width: 6px;
}

#jit-messages::-webkit-scrollbar-track {
    background: rgba(0, 217, 255, 0.05);
}

#jit-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 217, 255, 0.3);
    border-radius: 3px;
}

#jit-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 217, 255, 0.5);
}

/* Message bubbles */
.jit-message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    animation: ahmad-message-slide 0.3s ease;
}

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

.jit-message-assistant {
    justify-content: flex-start;
}

.jit-message-system {
    justify-content: center;
}

@keyframes ahmad-message-slide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.jit-message-bubble {
    padding: 10px 14px;
    border-radius: 8px;
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 13px;
    max-width: 90%;
}

.jit-message-user .jit-message-bubble {
    background: var(--ahmad-cyan);
    color: var(--ahmad-primary);
    border-bottom-right-radius: 2px;
    font-weight: 500;
}

.jit-message-assistant .jit-message-bubble {
    background: var(--ahmad-tertiary);
    color: var(--ahmad-text-primary);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-bottom-left-radius: 2px;
}

.jit-message-system .jit-message-bubble {
    background: rgba(0, 217, 255, 0.1);
    color: var(--ahmad-text-secondary);
    border: 1px solid rgba(0, 217, 255, 0.2);
    font-size: 11px;
    font-style: italic;
}

/* Composer */
.jit-composer {
    padding: 12px;
    border-top: 1px solid rgba(0, 217, 255, 0.2);
    background: var(--ahmad-primary);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Input textarea */
#jit-input {
    width: 100%;
    min-height: 48px;
    max-height: 100px;
    padding: 10px 12px;
    background: var(--ahmad-tertiary);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: 4px;
    color: var(--ahmad-text-primary);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    transition: all 0.2s ease;
}

#jit-input:focus {
    outline: none;
    border-color: var(--ahmad-cyan);
    box-shadow: 0 0 8px rgba(0, 217, 255, 0.3);
}

#jit-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Composer controls */
.jit-composer-controls {
    display: flex;
    gap: 6px;
}

.jit-btn-send,
.jit-btn-stop,
.jit-btn-clear {
    flex: 1;
    padding: 8px 12px;
    background: rgba(0, 217, 255, 0.1);
    border: 1px solid rgba(0, 217, 255, 0.3);
    color: var(--ahmad-cyan);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.jit-btn-send:hover:not(:disabled),
.jit-btn-stop:hover:not(:disabled),
.jit-btn-clear:hover:not(:disabled) {
    background: rgba(0, 217, 255, 0.2);
    border-color: var(--ahmad-gold);
    color: var(--ahmad-gold);
}

.jit-btn-send:active:not(:disabled),
.jit-btn-stop:active:not(:disabled),
.jit-btn-clear:active:not(:disabled) {
    transform: scale(0.95);
}

.jit-btn-send:disabled,
.jit-btn-stop:disabled,
.jit-btn-clear:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.jit-btn-stop {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.jit-btn-stop:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

/* Mobile responsive */
@media (max-width: 480px) {
    #jit-panel {
        width: 95vw;
        height: 80vh;
        bottom: 70px;
        right: 2.5vw;
    }

    .jit-message-bubble {
        max-width: 95%;
    }

    #jit-toggle {
        width: 52px;
        height: 52px;
        font-size: 24px;
    }
}

/* Utilities */
.ahmad-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(0, 217, 255, 0.3);
    border-top-color: var(--ahmad-cyan);
    border-radius: 50%;
    animation: ahmad-spin 0.8s linear infinite;
}

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

/* Print styles */
@media print {
    #jit-launcher,
    #jit-panel {
        display: none;
    }
}
