/* wsp.ai - Chat Panel Styles - Material Design 3 */

/* ============================================
   CHAT PANELS
   ============================================ */

.chat-panel {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.chat-panel.active {
    display: flex;
}

.chat-panel-header {
    padding: calc(var(--spacing-lg) * 0.8) var(--spacing-md);
    background-color: #1b1b1b;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chat-panel-header .header-content h3 {
    font-size: 20px;
    font-weight: 500;
    color: #90caf9;
    margin: 0 0 4px 0;
}

.chat-panel-header .panel-subtitle {
    font-size: 12px;
    color: #b0b0b0;
    margin: 0;
}

.chat-panel-header .header-actions {
    display: flex;
    gap: 8px;
}

/* ============================================
   CHAT MESSAGES
   ============================================ */

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    background-color: #1b1b1b;
}

.chat-message {
    display: flex;
    gap: var(--spacing-md);
    animation: messageSlideIn var(--transition-normal);
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.chat-message.assistant .message-avatar {
    background: transparent;
    border: 1px solid rgba(144, 202, 249, 0.3);
    color: #90caf9;
}

.chat-message.assistant .message-avatar:hover {
    border-color: rgba(144, 202, 249, 0.5);
    background-color: rgba(144, 202, 249, 0.05);
}

.chat-message.user .message-avatar {
    background: rgba(144, 202, 249, 0.2);
    border: 1px solid rgba(144, 202, 249, 0.5);
    color: #90caf9;
}

.chat-message.user .message-avatar:hover {
    border-color: rgba(144, 202, 249, 0.7);
    background-color: rgba(144, 202, 249, 0.25);
}

.message-avatar .material-symbols-outlined {
    font-size: 20px;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-xs);
}

.message-sender {
    font-size: 13px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

.message-time {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
}

.message-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--md-sys-color-on-surface);
}

.message-text p {
    margin-bottom: var(--spacing-sm);
}

.message-text ul,
.message-text ol {
    margin-left: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.message-text li {
    margin-bottom: 4px;
}

/* Code Block in Messages */
.code-block {
    background-color: var(--md-sys-color-surface-container-highest);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin: var(--spacing-sm) 0;
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-xs) var(--spacing-sm);
    background-color: var(--md-sys-color-surface-container-high);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
}

.code-action {
    background: transparent;
    border: none;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    transition: all var(--transition-fast);
}

.code-action:hover {
    background-color: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
}

.code-action .material-symbols-outlined {
    font-size: 16px;
}

.code-block pre {
    padding: var(--spacing-md);
    margin: 0;
    overflow-x: auto;
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: var(--md-sys-color-on-surface);
}

/* Message Actions */
.message-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-sm);
}

.message-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.message-action-btn:hover {
    background-color: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
}

.message-action-btn .material-symbols-outlined {
    font-size: 18px;
}

.action-button {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 10px 16px;
    border-radius: 24px;
    border: 1px solid rgba(144, 202, 249, 0.2);
    background: rgba(144, 202, 249, 0.08);
    color: #90caf9;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.action-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: rgba(144, 202, 249, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.action-button:active::before {
    transform: translate(-50%, -50%) scale(2);
    opacity: 0;
}

.action-button.primary {
    background: rgba(144, 202, 249, 0.08);
    border: 1px solid rgba(144, 202, 249, 0.2);
    color: #90caf9;
}

.action-button.primary:hover {
    background: rgba(144, 202, 249, 0.15);
    border-color: rgba(144, 202, 249, 0.4);
    box-shadow: 0 4px 12px rgba(144, 202, 249, 0.2);
    transform: translateY(-1px);
}

.action-button.primary:active {
    transform: translateY(0);
}

.action-button .material-symbols-outlined {
    font-size: 18px;
}

/* ============================================
   CHAT INPUT
   ============================================ */

.chat-input-container {
    border-top: 1px solid var(--md-sys-color-outline-variant);
    background-color: var(--md-sys-color-surface-container-low);
    position: relative;
    height: 225px;
    min-height: 180px;
    max-height: 500px;
    display: flex;
    flex-direction: column;
}

/* Vertical Resize Handle */
.chat-resize-handle {
    position: absolute;
    top: -3px;
    left: 0;
    right: 0;
    height: 6px;
    cursor: row-resize;
    background: transparent;
    z-index: 10;
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.chat-resize-handle::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.chat-resize-handle:hover::before {
    background: linear-gradient(
        to right,
        transparent,
        #90caf9 10%,
        #90caf9 90%,
        transparent
    );
    box-shadow: 0 0 8px rgba(144, 202, 249, 0.6);
    height: 3px;
}

.chat-resize-handle.resizing::before {
    background: linear-gradient(
        to right,
        transparent,
        #2196f3 10%,
        #2196f3 90%,
        transparent
    );
    box-shadow: 0 0 12px rgba(33, 150, 243, 0.8);
    height: 4px;
}

.chat-attachments {
    display: flex;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md) 0;
    background-color: #252525;
}

.attachment-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.attachment-btn:hover {
    background-color: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
}

.attachment-btn .material-symbols-outlined {
    font-size: 20px;
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    flex: 1;
    overflow: hidden;
    background-color: #252525;
}

.chat-input {
    flex: 1;
    background-color: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--md-sys-color-on-surface);
    font-size: 14px;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.5;
    resize: none;
    outline: none;
    height: 100%;
    transition: all var(--transition-fast);
}

.chat-input:focus {
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 2px rgba(168, 199, 250, 0.2);
}

.chat-input::placeholder {
    color: var(--md-sys-color-on-surface-variant);
}

.send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    margin-top: 12px;
}

.send-button:hover {
    background-color: var(--md-sys-color-primary-container);
    box-shadow: var(--md-sys-elevation-2);
    transform: scale(1.05);
}

.send-button:active {
    transform: scale(0.95);
}

.send-button .material-symbols-outlined {
    font-size: 20px;
}

.chat-footer {
    padding: 0 var(--spacing-md) var(--spacing-sm);
    background-color: #252525;
}

.chat-hint {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--md-sys-color-on-surface-variant);
}

.chat-hint .material-symbols-outlined {
    font-size: 14px;
}

/* ============================================
   CHAT HISTORY
   ============================================ */

.chat-history-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    background-color: #1b1b1b;
    scroll-behavior: smooth;
}

.history-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.history-group-header {
    font-size: 11px;
    font-weight: 500;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--spacing-xs) var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
}

.history-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 8px 14px;
    background: rgba(144, 202, 249, 0.08);
    border: 1px solid rgba(144, 202, 249, 0.2);
    border-radius: 8px;
    color: #90caf9;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-align: left;
}

.history-item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: rgba(144, 202, 249, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.history-item:active::before {
    transform: translate(-50%, -50%) scale(2);
    opacity: 0;
}

.history-item:hover {
    background: rgba(144, 202, 249, 0.15);
    border-color: rgba(144, 202, 249, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(144, 202, 249, 0.2);
}

.history-item .material-symbols-outlined {
    font-size: 18px;
    flex-shrink: 0;
}

.history-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.history-item-title {
    font-weight: 500;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-time {
    font-size: 11px;
    color: #888;
}

.chat-history-content::-webkit-scrollbar {
    width: 8px;
}

.chat-history-content::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.chat-history-content::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

.chat-history-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .chat-messages {
        padding: var(--spacing-sm);
    }
    
    .message-text {
        font-size: 13px;
    }
}
