/**
 * Bitghost AI Sandbox - Frontend Styles
 * Version: 2.0.0
 * Author: Bitghost.com
 * Design Language: Angular UI/UX, Dark Mode, Shimmer Effects
 */

.bgai-sandbox-container {
    background: #000000;
    border: 22px solid #2a2a2a;
    padding: 0;
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
    color: #ffffff;
    position: relative;
    overflow: hidden;
}

.bgai-sandbox-header {
    background: #0a0a0a;
    border-bottom: 1px solid #2a2a2a;
    padding: 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bgai-sandbox-title {
    font-size: 24px;
    font-weight: 900;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #ffffff, #00ff88);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bgai-sandbox-title::before {
    content: '🎲 ';
    filter: none;
    -webkit-text-fill-color: initial;
}

.bgai-sandbox-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #00ff88;
}

.bgai-sandbox-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #00ff88;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.bgai-sandbox-body {
    display: grid;
    grid-template-rows: 1fr auto;
    height: 500px;
}

.bgai-chat-messages {
    padding: 32px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    background: #000000;
}

.bgai-chat-messages::-webkit-scrollbar {
    width: 8px;
}

.bgai-chat-messages::-webkit-scrollbar-track {
    background: #0a0a0a;
}

.bgai-chat-messages::-webkit-scrollbar-thumb {
    background: #2a2a2a;
    border-radius: 4px;
}

.bgai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #00ff88;
}

.bgai-message {
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: slideUp 0.3s ease;
}

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

.bgai-message-role {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
}

.bgai-message-user .bgai-message-role {
    color: #00ff88;
}

.bgai-message-assistant .bgai-message-role {
    color: #ffffff;
}

.bgai-message-content {
    background: #0a0a0a;
    border: 1px solid #2a2a2a;
    padding: 16px 20px;
    line-height: 1.6;
    font-size: 14px;
    position: relative;
}

.bgai-message-user .bgai-message-content {
    border-left: 4px solid #00ff88;
}

.bgai-message-assistant .bgai-message-content {
    border-left: 4px solid #ffffff;
}

.bgai-message-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    color: #666666;
    margin-top: 8px;
}

.bgai-chat-input-container {
    border-top: 1px solid #2a2a2a;
    background: #0a0a0a;
    padding: 24px 32px;
}

.bgai-chat-input-wrapper {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
}

.bgai-chat-input {
    background: #000000;
    border: 1px solid #2a2a2a;
    color: #ffffff;
    padding: 16px 20px;
    font-size: 14px;
    font-family: 'SF Mono', monospace;
    resize: none;
    min-height: 60px;
    transition: all 0.3s ease;
}

.bgai-chat-input:focus {
    outline: none;
    border-color: #00ff88;
    box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.1);
}

.bgai-chat-input::placeholder {
    color: #666666;
}

.bgai-chat-send {
    background: #00ff88;
    color: #000000;
    border: none;
    padding: 0 32px;
    font-size: 14px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.bgai-chat-send::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left 0.5s ease;
}

.bgai-chat-send:hover::before {
    left: 100%;
}

.bgai-chat-send:hover {
    background: #00cc6f;
    transform: scale(1.05);
}

.bgai-chat-send:active {
    transform: scale(0.95);
}

.bgai-chat-send:disabled {
    background: #2a2a2a;
    color: #666666;
    cursor: not-allowed;
    transform: none;
}

.bgai-loading-dots {
    display: flex;
    gap: 6px;
    padding: 16px 20px;
}

.bgai-loading-dot {
    width: 8px;
    height: 8px;
    background: #00ff88;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.bgai-loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.bgai-loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.bgai-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 16px;
    color: #666666;
    text-align: center;
}

.bgai-empty-icon {
    font-size: 64px;
    opacity: 0.3;
}

.bgai-empty-text {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.bgai-error-message {
    background: rgba(255, 51, 102, 0.1);
    border: 1px solid #ff3366;
    border-left: 4px solid #ff3366;
    color: #ff3366;
    padding: 16px 20px;
    margin: 16px 0;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-line;
}

.bgai-timeout-warning {
    background: rgba(255, 170, 0, 0.1);
    border: 1px solid #ffaa00;
    border-left: 4px solid #ffaa00;
    color: #ffaa00;
    padding: 16px 20px;
    margin: 16px 0;
    font-size: 13px;
    text-align: center;
    animation: pulse-warning 2s infinite;
}

.bgai-timeout-warning small {
    display: block;
    margin-top: 8px;
    opacity: 0.8;
    font-size: 11px;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .bgai-sandbox-container {
        border-width: 11px;
    }
    
    .bgai-sandbox-header {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }
    
    .bgai-chat-messages {
        padding: 16px;
    }
    
    .bgai-chat-input-container {
        padding: 16px;
    }
    
    .bgai-chat-input-wrapper {
        grid-template-columns: 1fr;
    }
    
    .bgai-chat-send {
        padding: 16px;
    }
    
    .bgai-preview-modal {
        width: 95%;
        max-height: 85vh;
    }
}

/* Network Hash Display */
.bgai-network-hash {
    font-family: 'SF Mono', monospace;
    font-size: 9px;
    color: #00ff88;
    word-break: break-all;
    opacity: 0.6;
}

/* Shimmer Effect on Messages - Enhanced */
.bgai-message-assistant .bgai-message-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(0, 255, 136, 0.08),
        transparent
    );
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Code Blocks with High Contrast */
.bgai-message-content code {
    background: #1a1a1a;
    color: #00ff88;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'SF Mono', monospace;
    font-size: 13px;
    font-weight: 600;
}

.bgai-message-content pre {
    background: #0a0a0a;
    border: 1px solid #2a2a2a;
    border-left: 4px solid #00ff88;
    padding: 20px;
    overflow-x: auto;
    margin: 16px 0;
    border-radius: 4px;
}

.bgai-message-content pre code {
    background: none;
    color: #e8e8e8;
    padding: 0;
    border-radius: 0;
    display: block;
    line-height: 1.6;
    font-size: 13px;
    font-weight: 500;
}

/* Ensure all text in code blocks is visible */
.bgai-code-block {
    background: #0a0a0a !important;
    border: 1px solid #2a2a2a !important;
    border-left: 4px solid #00ff88 !important;
    padding: 20px !important;
    color: #e8e8e8 !important;
    font-family: 'SF Mono', monospace !important;
    font-size: 13px !important;
    line-height: 1.6 !important;
    overflow-x: auto !important;
    margin: 16px 0 !important;
    border-radius: 4px !important;
}

.bgai-code-block code {
    color: #e8e8e8 !important;
    background: none !important;
    font-weight: 500 !important;
}

/* HTML Preview Button */
.bgai-code-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    align-items: center;
}

.bgai-preview-btn,
.bgai-copy-code-btn {
    display: inline-flex;
    align-items: center;
    background: #0a0a0a;
    border: 2px solid #00ff88;
    color: #00ff88;
    padding: 10px 20px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'SF Mono', monospace;
    font-weight: 700;
    border-radius: 4px;
}

.bgai-preview-btn:hover,
.bgai-copy-code-btn:hover {
    background: #00ff88;
    color: #000000;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 255, 136, 0.5);
}

.bgai-preview-btn:active,
.bgai-copy-code-btn:active {
    transform: translateY(0);
}

/* ZIP Download Button */
.bgai-download-btn {
    display: inline-block;
    background: #0a0a0a;
    border: 1px solid #ffffff;
    color: #ffffff;
    padding: 8px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 8px 8px 8px 0;
    font-family: 'SF Mono', monospace;
    font-weight: 700;
}

.bgai-download-btn:hover {
    background: #ffffff;
    color: #000000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

/* Preview Modal */
.bgai-preview-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    background: #000000;
    border: 2px solid #00ff88;
    box-shadow: 0 20px 60px rgba(0, 255, 136, 0.3);
    z-index: 10000;
    flex-direction: column;
}

.bgai-preview-modal.active {
    display: flex;
}

.bgai-preview-modal-header {
    background: #0a0a0a;
    border-bottom: 1px solid #2a2a2a;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
}

.bgai-preview-modal-title {
    font-size: 14px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #00ff88;
}

.bgai-preview-modal-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: all 0.3s ease;
}

.bgai-preview-modal-close:hover {
    color: #ff3366;
    transform: rotate(90deg);
}

.bgai-preview-modal-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
    background: #ffffff;
}

.bgai-preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #ffffff;
}

.bgai-preview-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    z-index: 9999;
}

.bgai-preview-modal-overlay.active {
    display: block;
}

/* Action Buttons */
.bgai-message-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.bgai-action-btn {
    background: none;
    border: 1px solid #2a2a2a;
    color: #666666;
    padding: 6px 12px;
    font-size: 11px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
}

.bgai-action-btn:hover {
    border-color: #00ff88;
    color: #00ff88;
}

/* Clear Chat Button */
.bgai-clear-chat {
    background: none;
    border: 1px solid #2a2a2a;
    color: #666666;
    padding: 8px 16px;
    font-size: 11px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
}

.bgai-clear-chat:hover {
    border-color: #ff3366;
    color: #ff3366;
}
