/* ===========================================
   SECUREBOT STUDIO - DEMO STYLES
   =========================================== */

:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --bg-tertiary: #1a1a3a;
    --aurora-1: #7c3aed;
    --aurora-2: #a855f7;
    --aurora-3: #c084fc;
    --aurora-4: #06b6d4;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

/* Header */
.demo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(18, 18, 42, 0.9);
    border-bottom: 1px solid rgba(168, 85, 247, 0.2);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo {
    font-size: 1.5rem;
    color: var(--aurora-2);
}

.brand-name {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
}

.product-name {
    color: var(--text-muted);
    padding-left: 0.75rem;
    border-left: 1px solid rgba(168, 85, 247, 0.3);
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.btn-primary,
.btn-secondary {
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--aurora-1), var(--aurora-2));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4);
}

.btn-secondary {
    background: transparent;
    border: 1px solid rgba(168, 85, 247, 0.4);
    color: var(--aurora-3);
}

.btn-secondary:hover {
    background: rgba(168, 85, 247, 0.1);
}

/* Main Container */
.studio-container {
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 1.5rem;
    padding: 1.5rem;
    height: calc(100vh - 120px);
}

/* Panels */
.config-panel,
.templates-panel {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 1.25rem;
    overflow-y: auto;
    border: 1px solid rgba(168, 85, 247, 0.1);
}

.panel-section {
    margin-bottom: 1.5rem;
}

.panel-section h3 {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--aurora-2);
}

/* Compliance Badges */
.compliance-badges {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.compliance-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
}

.compliance-toggle input:checked+span {
    color: var(--success);
}

/* Knowledge Sources */
.source-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.source-item:hover {
    background: rgba(168, 85, 247, 0.15);
}

.source-item.active {
    border: 1px solid var(--aurora-2);
}

.source-status {
    margin-left: auto;
    color: var(--success);
}

.btn-add-source {
    width: 100%;
    padding: 0.6rem;
    background: transparent;
    border: 1px dashed rgba(168, 85, 247, 0.3);
    border-radius: 8px;
    color: var(--aurora-3);
    cursor: pointer;
    font-size: 0.85rem;
}

/* Deploy Options */
.deploy-options {
    display: flex;
    gap: 0.5rem;
}

.deploy-option {
    flex: 1;
    padding: 0.6rem;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s;
}

.deploy-option:hover,
.deploy-option.active {
    border-color: var(--aurora-2);
    color: var(--aurora-3);
}

/* Preview Panel */
.preview-panel {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(168, 85, 247, 0.1);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.preview-header h3 {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.preview-controls {
    display: flex;
    gap: 0.5rem;
}

.preview-device {
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
}

.preview-device.active {
    border-color: var(--aurora-2);
}

/* Chat Preview */
.chat-preview {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 2rem;
    background: radial-gradient(ellipse at center, rgba(124, 58, 237, 0.1) 0%, transparent 70%);
}

.chat-widget {
    width: 360px;
    background: var(--bg-primary);
    border-radius: 16px;
    border: 1px solid rgba(168, 85, 247, 0.3);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.widget-header {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: linear-gradient(135deg, var(--aurora-1), var(--aurora-2));
}

.widget-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.widget-info {
    margin-left: 0.75rem;
    flex: 1;
}

.widget-name {
    font-weight: 600;
    display: block;
}

.widget-status {
    font-size: 0.75rem;
    opacity: 0.8;
}

.widget-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.7;
}

.widget-messages {
    padding: 1rem;
    min-height: 300px;
    max-height: 350px;
    overflow-y: auto;
}

.message {
    margin-bottom: 1rem;
}

.message.bot .message-content {
    background: var(--bg-tertiary);
    padding: 0.75rem 1rem;
    border-radius: 12px 12px 12px 0;
    display: inline-block;
    max-width: 85%;
}

.message.user .message-content {
    background: linear-gradient(135deg, var(--aurora-1), var(--aurora-2));
    padding: 0.75rem 1rem;
    border-radius: 12px 12px 0 12px;
    display: inline-block;
    max-width: 85%;
    float: right;
}

.widget-input {
    display: flex;
    padding: 1rem;
    border-top: 1px solid rgba(168, 85, 247, 0.2);
    gap: 0.5rem;
}

.widget-input input {
    flex: 1;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
}

.widget-input button {
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, var(--aurora-1), var(--aurora-2));
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
}

/* Templates */
.template-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.template-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.template-card:hover {
    border-color: var(--aurora-2);
    background: rgba(168, 85, 247, 0.1);
}

.template-icon {
    font-size: 1.5rem;
}

.template-info h4 {
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
}

.template-info p {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Analytics */
.analytics-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.stat-card {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--aurora-2), var(--aurora-4));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: block;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Demo Banner */
.demo-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem;
    background: linear-gradient(135deg, var(--aurora-1), var(--aurora-2));
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

.demo-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--aurora-1);
    border-radius: 3px;
}

/* ============================================
   ENHANCED MESSAGE STYLES
   ============================================ */

.message {
    margin-bottom: 1rem;
    clear: both;
}

.message-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    opacity: 0.7;
}

.message.user .message-time {
    text-align: right;
}

.message.bot .message-content {
    background: var(--bg-tertiary);
    padding: 0.85rem 1.1rem;
    border-radius: 16px 16px 16px 4px;
    display: inline-block;
    max-width: 85%;
    line-height: 1.5;
    font-size: 0.9rem;
}

.message.user .message-content {
    background: linear-gradient(135deg, var(--aurora-1), var(--aurora-2));
    padding: 0.85rem 1.1rem;
    border-radius: 16px 16px 4px 16px;
    display: inline-block;
    max-width: 85%;
    float: right;
    line-height: 1.5;
    font-size: 0.9rem;
}

/* Animated Typing Indicator */
.typing-indicator .message-content {
    padding: 1rem 1.25rem;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--aurora-2);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

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

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

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Button Loading State */
.btn-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

/* Template Card Enhancement */
.template-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
}

.template-card:hover {
    border-color: var(--aurora-2);
    background: rgba(168, 85, 247, 0.15);
    transform: translateX(4px);
}

/* Widget Header Animation */
.widget-header {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, var(--aurora-1), var(--aurora-2));
    transition: background 0.4s ease;
}

.widget-name {
    font-weight: 600;
    display: block;
    transition: opacity 0.3s ease;
}

/* Widget Status Online Indicator */
.widget-status::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Input Focus Enhancement */
.widget-input {
    display: flex;
    padding: 1rem;
    border-top: 1px solid rgba(168, 85, 247, 0.2);
    gap: 0.5rem;
    transition: all 0.2s;
}

.widget-input input {
    flex: 1;
    padding: 0.85rem;
    background: var(--bg-tertiary);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 10px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.widget-input input:focus {
    outline: none;
    border-color: var(--aurora-2);
    background: rgba(168, 85, 247, 0.05);
}

.widget-input input:disabled {
    opacity: 0.6;
}

.widget-input button {
    padding: 0.85rem 1.25rem;
    background: linear-gradient(135deg, var(--aurora-1), var(--aurora-2));
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.1rem;
}

.widget-input button:hover {
    transform: scale(1.05);
}

.widget-input button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Stat Card Hover */
.stat-card {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.stat-card:hover {
    border-color: var(--aurora-2);
    transform: translateY(-2px);
}

/* Source Item Animation */
.source-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 0.85rem;
    background: var(--bg-tertiary);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.source-item:hover {
    background: rgba(168, 85, 247, 0.15);
    transform: translateX(4px);
}

.source-item.active {
    border-color: var(--aurora-2);
    background: rgba(168, 85, 247, 0.1);
}

/* Compliance Badge Animation */
.compliance-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.compliance-toggle:hover {
    border-color: rgba(168, 85, 247, 0.3);
}

.compliance-toggle:has(input:checked) {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}

/* Deploy Option Enhancement */
.deploy-option {
    flex: 1;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.deploy-option:hover {
    border-color: rgba(168, 85, 247, 0.4);
    transform: translateY(-2px);
}

.deploy-option.active {
    border-color: var(--aurora-2);
    color: var(--aurora-3);
    background: rgba(168, 85, 247, 0.1);
}