/* AI Task Assistant Sidepanel Styles */

.ai-sidepanel {
    position: fixed;
    top: 0;
    right: -500px;
    width: 500px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.1);
    z-index: 1050;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #dee2e6;
}

.ai-sidepanel.open {
    right: 0;
}

.ai-sidepanel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ai-sidepanel-overlay.show {
    opacity: 1;
    visibility: visible;
}

body.ai-sidepanel-open {
    overflow: hidden;
}

/* Sidepanel Header */
.sidepanel-header {
    padding: 1.5rem;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
}

.sidepanel-header h5 {
    color: #495057;
    font-weight: 600;
}

/* Sidepanel Body */
.sidepanel-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.conversation-container {
    flex: 1;
    overflow: hidden;
}

.messages-area {
    height: 100%;
    overflow-y: auto;
    padding: 1rem;
    scroll-behavior: smooth;
}

/* Messages */
.message {
    margin-bottom: 1rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.message.show {
    opacity: 1;
    transform: translateY(0);
}

/* Task preview styling */
.task-preview-container {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 0.5rem 0;
}

.task-preview-header {
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
}

.task-preview-header h5 {
    color: #495057;
    font-weight: 600;
}

.task-preview-details {
    font-size: 0.9rem;
}

.task-preview-details strong {
    color: #495057;
}

.task-preview-details i {
    color: #6c757d;
    width: 16px;
}

.task-preview-container .badge {
    font-size: 0.75rem;
}

.task-preview-container ol,
.task-preview-container ul {
    margin-bottom: 0.5rem;
}

.task-preview-container ol li,
.task-preview-container ul li {
    font-size: 0.85rem;
    color: #6c757d;
}

.user-message {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.user-bubble {
    background: #007bff;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 1rem 1rem 0.25rem 1rem;
    max-width: 95%;
    min-width: 200px;
    word-wrap: break-word;
}

.ai-message,
.system-message {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 1rem;
}

.ai-bubble {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 0.75rem 1rem;
    border-radius: 0.25rem 1rem 1rem 1rem;
    max-width: 95%;
    min-width: 250px;
    word-wrap: break-word;
}

.message-text {
    line-height: 1.5;
}

.message-text strong {
    font-weight: 600;
    color: #495057;
}

.message-time {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.user-bubble .message-time {
    color: rgba(255, 255, 255, 0.8);
}

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

.typing-dots {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.typing-dots span {
    width: 0.5rem;
    height: 0.5rem;
    background: #6c757d;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

.typing-dots 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;
    }
}

/* Sidepanel Footer */
.sidepanel-footer {
    padding: 1rem;
    border-top: 1px solid #dee2e6;
    background: white;
}

.input-container textarea {
    resize: none;
    min-height: 2.5rem;
    max-height: 120px;
}

.input-container .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.action-buttons {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .ai-sidepanel {
        width: 100%;
        right: -100%;
    }

    .user-bubble {
        max-width: 90%;
        min-width: 150px;
    }

    .ai-bubble {
        max-width: 95%;
        min-width: 200px;
    }
}

@media (max-width: 576px) {
    .sidepanel-header {
        padding: 1rem;
    }

    .messages-area {
        padding: 0.75rem;
    }

    .sidepanel-footer {
        padding: 0.75rem;
    }

    .user-bubble {
        max-width: 85%;
        min-width: 120px;
    }

    .ai-bubble {
        max-width: 90%;
        min-width: 150px;
    }
}

/* Custom scrollbar for messages area */
.messages-area::-webkit-scrollbar {
    width: 6px;
}

.messages-area::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.messages-area::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.messages-area::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Button loading states */
.btn:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.btn .fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Focus states */
.ai-sidepanel textarea:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ai-sidepanel {
        border-left: 2px solid #000;
    }

    .ai-bubble {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

    .ai-sidepanel,
    .ai-sidepanel-overlay,
    .message,
    .action-buttons {
        transition: none;
    }

    .typing-dots span {
        animation: none;
    }

    .fa-spinner {
        animation: none;
    }
}