/**
 * DeepSeek AI Chatbot - WordPress Plugin Styles
 * Version: 1.0.0
 */

/* Reset and base styles */
.deepseek-chat-container,
.deepseek-chat-container * {
    box-sizing: border-box;
}

/* Main chat container */
.deepseek-chat-container {
    width: 100%;
    height: 600px;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e1e5e9;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: relative;
    overflow: hidden;
}

.deepseek-chat-container:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* Dark theme */
.deepseek-chat-container[data-theme="dark"] {
    background: #1a1a1a;
    border-color: #333;
    color: #ffffff;
}

.deepseek-chat-container[data-theme="dark"] .deepseek-chat-header {
    background: #2d2d2d;
    border-bottom-color: #404040;
}

.deepseek-chat-container[data-theme="dark"] .deepseek-message-assistant {
    background: #2d2d2d;
    color: #ffffff;
    border-color: #404040;
}

.deepseek-chat-container[data-theme="dark"] .deepseek-input-area {
    background: #2d2d2d;
    border-top-color: #404040;
}

.deepseek-chat-container[data-theme="dark"] .deepseek-input {
    background: #333;
    border-color: #555;
    color: #fff;
}

.deepseek-chat-container[data-theme="dark"] .deepseek-input:focus {
    border-color: #007fff;
    background: #404040;
}

/* Chat header */
.deepseek-chat-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8f9fa;
    border-radius: 16px 16px 0 0;
}

/* Model tabs */
.deepseek-model-tabs {
    display: flex;
    gap: 8px;
}

.deepseek-tab {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #6b7280;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.deepseek-tab:hover {
    background: #f8fafc;
    border-color: #007fff;
    color: #007fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 127, 255, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
}

.deepseek-tab.active {
    background: #007fff;
    color: white;
    border-color: #007fff;
    box-shadow: 0 4px 12px rgba(0, 127, 255, 0.3), 0 2px 4px rgba(0, 127, 255, 0.2);
    transform: translateY(-1px);
}

/* Messages area */
.deepseek-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.deepseek-messages::-webkit-scrollbar {
    width: 6px;
}

.deepseek-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.deepseek-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.deepseek-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Message bubbles */
.deepseek-message {
    display: flex;
    max-width: 85%;
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.deepseek-message.user {
    align-self: flex-end;
    justify-content: flex-end;
}

.deepseek-message.assistant {
    align-self: flex-start;
    justify-content: flex-start;
}

.deepseek-message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    max-width: 100%;
}

.deepseek-message.user .deepseek-message-content {
    background: #007fff;
    color: white;
    border-radius: 18px 18px 6px 18px;
    box-shadow: 0 2px 8px rgba(0, 127, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.1);
}

.deepseek-message.assistant .deepseek-message-content {
    background: #f8f9fa;
    color: #1f2937;
    border-radius: 18px 18px 18px 6px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Typing indicator */
.deepseek-typing-indicator {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 18px 18px 18px 6px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.deepseek-typing-dots {
    display: flex;
    gap: 4px;
}

.deepseek-typing-dot {
    width: 8px;
    height: 8px;
    background: #6b7280;
    border-radius: 50%;
    animation: pulse 1.4s infinite ease-in-out;
}

.deepseek-typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.deepseek-typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

.deepseek-typing-dot:nth-child(3) {
    animation-delay: 0s;
}

@keyframes pulse {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input area */
.deepseek-input-area {
    padding: 16px;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
    border-radius: 0 0 16px 16px;
}

.deepseek-input-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.deepseek-input {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    background: #ffffff;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.deepseek-input:focus {
    border-color: #007fff;
    box-shadow: 0 0 0 3px rgba(0, 127, 255, 0.1), 0 2px 8px rgba(0, 127, 255, 0.15);
    transform: translateY(-1px);
}

.deepseek-input::placeholder {
    color: #9ca3af;
}

/* Buttons */
.deepseek-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 18px;
}

.deepseek-send-button {
    background: #007fff;
    color: white;
    box-shadow: 0 2px 6px rgba(0, 127, 255, 0.2);
}

.deepseek-send-button:hover:not(:disabled) {
    background: #0066cc;
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0, 127, 255, 0.3);
}

.deepseek-send-button:active {
    transform: scale(0.95);
}

.deepseek-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.deepseek-file-button {
    background: #f3f4f6;
    color: #4b5563;
}

.deepseek-file-button:hover {
    background: #e5e7eb;
    color: #1f2937;
    transform: scale(1.05);
}

/* File attachments */
.deepseek-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px 0;
}

.deepseek-attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #f3f4f6;
    border-radius: 16px;
    font-size: 12px;
    color: #4b5563;
}

.deepseek-attachment-remove {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: color 0.2s;
}

.deepseek-attachment-remove:hover {
    color: #dc2626;
}

.deepseek-attachment-image {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    object-fit: cover;
}

/* Loading states */
.deepseek-chat-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6b7280;
}

.deepseek-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #007fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Floating chat styles */
.deepseek-floating-chat {
    position: fixed;
    z-index: 9999;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.deepseek-floating-chat[data-position="bottom-right"] {
    bottom: 20px;
    right: 20px;
}

.deepseek-floating-chat[data-position="bottom-left"] {
    bottom: 20px;
    left: 20px;
}

.deepseek-floating-chat[data-position="top-right"] {
    top: 20px;
    right: 20px;
}

.deepseek-floating-chat[data-position="top-left"] {
    top: 20px;
    left: 20px;
}

.deepseek-floating-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #007fff;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 16px rgba(0, 127, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.deepseek-floating-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 127, 255, 0.4);
}

.deepseek-floating-trigger.active {
    transform: rotate(45deg);
}

.deepseek-floating-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
}

.deepseek-floating-window.open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

.deepseek-floating-chat[data-position="bottom-left"] .deepseek-floating-window {
    right: auto;
    left: 0;
    transform-origin: bottom left;
}

.deepseek-floating-chat[data-position="top-right"] .deepseek-floating-window {
    bottom: auto;
    top: 80px;
    transform-origin: top right;
}

.deepseek-floating-chat[data-position="top-left"] .deepseek-floating-window {
    bottom: auto;
    top: 80px;
    right: auto;
    left: 0;
    transform-origin: top left;
}

/* Modal styles */
.deepseek-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.deepseek-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease-out;
}

.deepseek-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    height: 70%;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 64px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    animation: slideInUp 0.3s ease-out;
}

.deepseek-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 16px 16px 0 0;
}

.deepseek-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.deepseek-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s;
}

.deepseek-modal-close:hover {
    color: #dc2626;
}

.deepseek-modal-body {
    flex: 1;
    padding: 0;
    overflow: hidden;
    border-radius: 0 0 16px 16px;
}

.deepseek-modal-body .deepseek-chat-container {
    height: 100%;
    border: none;
    border-radius: 0 0 16px 16px;
    box-shadow: none;
}

/* Button styles */
.deepseek-modal-trigger,
.deepseek-action-button {
    background: #007fff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.deepseek-modal-trigger:hover,
.deepseek-action-button:hover {
    background: #0066cc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 127, 255, 0.3);
}

.deepseek-modal-trigger:active,
.deepseek-action-button:active {
    transform: translateY(0);
}

/* Markdown content styling */
.deepseek-message-content h1,
.deepseek-message-content h2,
.deepseek-message-content h3,
.deepseek-message-content h4,
.deepseek-message-content h5,
.deepseek-message-content h6 {
    margin: 16px 0 8px 0;
    font-weight: 600;
    line-height: 1.4;
}

.deepseek-message-content h1 { font-size: 1.25em; }
.deepseek-message-content h2 { font-size: 1.1em; }
.deepseek-message-content h3 { font-size: 1em; }

.deepseek-message-content p {
    margin: 8px 0;
    line-height: 1.6;
}

.deepseek-message-content ul,
.deepseek-message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.deepseek-message-content li {
    margin: 4px 0;
    line-height: 1.6;
}

.deepseek-message-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em;
    font-family: 'Courier New', monospace;
}

.deepseek-message-content pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 12px 0;
}

.deepseek-message-content pre code {
    background: none;
    padding: 0;
}

.deepseek-message-content blockquote {
    border-left: 3px solid #007fff;
    padding-left: 12px;
    margin: 12px 0;
    font-style: italic;
    color: #666;
}

.deepseek-message-content a {
    color: #007fff;
    text-decoration: none;
}

.deepseek-message-content a:hover {
    text-decoration: underline;
}

.deepseek-message-content strong {
    font-weight: 600;
}

.deepseek-message-content em {
    font-style: italic;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translate(-50%, -40%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .deepseek-floating-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        left: 20px !important;
        right: 20px !important;
        bottom: 80px;
        transform-origin: center bottom;
    }
    
    .deepseek-modal-content {
        width: 95%;
        height: 80%;
    }
    
    .deepseek-chat-container {
        border-radius: 8px;
    }
    
    .deepseek-message {
        max-width: 95%;
    }
}

@media (max-width: 480px) {
    .deepseek-floating-trigger {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .deepseek-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .deepseek-model-tabs {
        flex-direction: column;
        gap: 4px;
    }
    
    .deepseek-tab {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .deepseek-chat-container {
        border-width: 2px;
    }
    
    .deepseek-message-content {
        border-width: 2px;
    }
    
    .deepseek-input {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .deepseek-spinner {
        animation: none;
        border-top-color: transparent;
    }
}

/* Print styles */
@media print {
    .deepseek-floating-chat,
    .deepseek-modal {
        display: none !important;
    }
    
    .deepseek-chat-container {
        box-shadow: none;
        border: 1px solid #000;
    }
}
