/* California Tax Optimizer - Smart Chat Styles */

/* Smart Chat Container */
.smart-chat-container {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 140px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.smart-chat-container.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: all;
}

/* Smart Chat Panel */
.smart-chat-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    border: 1px solid var(--border);
    overflow: hidden;
}

/* Smart Chat Header */
.smart-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-on-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.smart-chat-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.smart-chat-title h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-on-primary);
}

.smart-chat-title i {
    font-size: 1.25rem;
}

.smart-chat-status {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    opacity: 0.9;
}

.smart-chat-status.online i {
    color: var(--success);
    font-size: 0.5rem;
}

.smart-chat-close {
    background: none;
    border: none;
    color: var(--text-on-primary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s;
}

.smart-chat-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Smart Chat Body */
.smart-chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface-alt);
}

.smart-chat-welcome {
    padding: 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.welcome-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.welcome-content h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 1rem;
}

.welcome-content p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.4;
}

/* Smart Chat Messages */
.smart-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.smart-chat-message {
    display: flex;
    gap: 0.75rem;
    animation: messageAppear 0.3s ease;
}

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

.smart-chat-message.user-message {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.user-message .message-avatar {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-on-primary);
}

.message-content {
    max-width: 75%;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.user-message .message-content {
    align-items: flex-end;
}

.message-text {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.user-message .message-text {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-on-primary);
    border-bottom-right-radius: var(--radius-sm);
}

.assistant-message .message-text {
    background: var(--surface);
    border-color: var(--border);
    border-bottom-left-radius: var(--radius-sm);
}

.message-text a {
    color: var(--primary);
    text-decoration: underline;
}

.message-text strong {
    font-weight: 600;
    color: var(--text-primary);
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    padding: 0 0.25rem;
}

/* Typing Indicator */
.typing .message-content {
    min-width: 60px;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    border-bottom-left-radius: var(--radius-sm);
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--text-tertiary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

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

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

/* Quick Actions */
.smart-chat-quick-actions {
    padding: 1rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.quick-action {
    flex: 1;
    min-width: 120px;
    padding: 0.75rem 1rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.quick-action:hover {
    background: var(--surface);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.quick-action:active {
    transform: translateY(0);
}

.quick-action i {
    font-size: 1rem;
}

/* Smart Chat Footer */
.smart-chat-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.smart-chat-input-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.smart-chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.smart-chat-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.smart-chat-input::placeholder {
    color: var(--text-tertiary);
}

.smart-chat-send {
    width: 44px;
    height: 44px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-lg);
    color: var(--text-on-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.smart-chat-send:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.smart-chat-send:active {
    transform: translateY(0);
}

.smart-chat-hints {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-align: center;
}

.hint {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--surface-alt);
    border-radius: var(--radius-sm);
}

/* Smart Chat Toggle Button */
.smart-chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 50%;
    color: var(--text-on-primary);
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-xl);
    z-index: 9999;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.smart-chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-2xl);
}

.smart-chat-toggle.active {
    background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
    transform: scale(0.95);
}

.smart-chat-toggle i {
    transition: transform 0.3s ease;
}

.smart-chat-toggle.active i {
    transform: rotate(90deg);
}

.smart-chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--error);
    color: white;
    font-size: 0.625rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Message Actions */
.message-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.message-action {
    padding: 0.25rem 0.5rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.message-action:hover {
    background: var(--surface);
    border-color: var(--primary);
    color: var(--primary);
}

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

.smart-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.smart-chat-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.smart-chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .smart-chat-container {
        width: calc(100vw - 40px);
        height: 70vh;
        bottom: 80px;
        right: 20px;
        left: 20px;
    }
    
    .smart-chat-toggle {
        width: 56px;
        height: 56px;
        font-size: 1.25rem;
    }
    
    .smart-chat-quick-actions {
        flex-direction: column;
    }
    
    .quick-action {
        min-width: 100%;
    }
    
    .message-content {
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    .smart-chat-container {
        width: calc(100vw - 32px);
        right: 16px;
        left: 16px;
        height: 60vh;
    }
    
    .smart-chat-header {
        padding: 0.875rem 1rem;
    }
    
    .smart-chat-title h3 {
        font-size: 1rem;
    }
    
    .smart-chat-welcome {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
    }
    
    .welcome-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    .smart-chat-messages {
        padding: 0.75rem;
    }
    
    .message-text {
        padding: 0.625rem 0.875rem;
        font-size: 0.8125rem;
    }
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
    .smart-chat-panel {
        background: var(--surface-dark);
        border-color: var(--border-dark);
    }
    
    .smart-chat-body {
        background: var(--surface-alt-dark);
    }
    
    .smart-chat-welcome {
        background: var(--surface-dark);
        border-color: var(--border-dark);
    }
    
    .message-text {
        background: var(--surface-dark);
        border-color: var(--border-dark);
        color: var(--text-primary-dark);
    }
    
    .assistant-message .message-text {
        background: var(--surface-dark);
        border-color: var(--border-dark);
    }
    
    .typing-indicator {
        background: var(--surface-dark);
        border-color: var(--border-dark);
    }
    
    .quick-action {
        background: var(--surface-alt-dark);
        border-color: var(--border-dark);
        color: var(--text-primary-dark);
    }
    
    .quick-action:hover {
        background: var(--surface-dark);
        border-color: var(--primary);
    }
    
    .smart-chat-input {
        background: var(--surface-alt-dark);
        border-color: var(--border-dark);
        color: var(--text-primary-dark);
    }
    
    .hint {
        background: var(--surface-alt-dark);
    }
}

/* Print styles */
@media print {
    .smart-chat-container,
    .smart-chat-toggle {
        display: none !important;
    }
}