/* Tutor Chat Widget Styles */

:root {
    --tutor-bg: #ffffff;
    --tutor-border: #e0e0e0;
    --tutor-text: #333;
    --tutor-text-light: #666;
    --tutor-bubble-bg: #f8f9fa;
}

[data-theme="dark"] {
    --tutor-bg: #1e293b;
    --tutor-border: #334155;
    --tutor-text: #f1f5f9;
    --tutor-text-light: #cbd5e1;
    --tutor-bubble-bg: #0f172a;
}

.tutor-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.tutor-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #34C759 0%, #30D158 100%);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(52, 199, 89, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.tutor-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(52, 199, 89, 0.6);
}

.tutor-button.open {
    transform: rotate(180deg);
}

.tutor-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 500px;
    height: 700px;
    background: var(--tutor-bg);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    z-index: 9998;
}

.tutor-window.open {
    display: flex;
    animation: slideUp 0.3s ease-out;
}

.tutor-window.maximized {
    position: fixed;
    bottom: 10px;
    right: 10px;
    top: 10px;
    width: calc(50vw - 15px);
    height: calc(100vh - 20px);
    border-radius: 16px;
    animation: expandRight 0.3s ease-out;
}

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

@keyframes expandRight {
    from {
        width: 500px;
        height: 700px;
        bottom: 90px;
        top: auto;
    }
    to {
        width: 50vw;
        height: 100vh;
        bottom: 0;
        top: 0;
    }
}

.tutor-header {
    background: linear-gradient(135deg, #34C759 0%, #30D158 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
}

.tutor-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.tutor-header-controls {
    display: flex;
    gap: 8px;
}

.tutor-control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.tutor-control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.tutor-header-icon {
    font-size: 24px;
}

.tutor-header-text h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.tutor-header-text p {
    margin: 4px 0 0 0;
    font-size: 12px;
    opacity: 0.9;
}

.tutor-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--tutor-bubble-bg);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: background 0.3s ease;
}

.tutor-message {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

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

.tutor-message.assistant {
    align-items: flex-start;
}

.tutor-message-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.6;
}

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

.tutor-message-bubble em {
    font-style: italic;
}

.tutor-message-bubble code {
    background: var(--tutor-bubble-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    color: #e11d48;
    border: 1px solid var(--tutor-border);
}

.tutor-message-bubble pre {
    background: #1e293b;
    color: #f8fafc;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
}

.tutor-message-bubble pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.tutor-message-bubble ul, .tutor-message-bubble ol {
    margin: 8px 0;
    padding-left: 24px;
}

.tutor-message-bubble li {
    margin: 4px 0;
}

.tutor-message-bubble p {
    margin: 8px 0;
}

.tutor-message-bubble p:first-child {
    margin-top: 0;
}

.tutor-message-bubble p:last-child {
    margin-bottom: 0;
}

.tutor-message-bubble a {
    color: #34C759;
    text-decoration: underline;
}

.tutor-message-bubble a:hover {
    color: #2DB04D;
}

.tutor-message-bubble h1,
.tutor-message-bubble h2,
.tutor-message-bubble h3 {
    margin: 12px 0 8px 0;
    font-weight: 600;
}

.tutor-message-bubble h1 {
    font-size: 16px;
}

.tutor-message-bubble h2 {
    font-size: 15px;
}

.tutor-message-bubble h3 {
    font-size: 14px;
}

.tutor-message.user .tutor-message-bubble {
    background: #34C759;
    color: white;
}

.tutor-message.user .tutor-message-bubble strong,
.tutor-message.user .tutor-message-bubble em,
.tutor-message.user .tutor-message-bubble code {
    color: white;
}

.tutor-message.assistant .tutor-message-bubble {
    background: var(--tutor-bg);
    color: var(--tutor-text);
    border: 1px solid var(--tutor-border);
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.tutor-input-container {
    padding: 16px;
    background: var(--tutor-bg);
    border-top: 1px solid var(--tutor-border);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.tutor-input-row {
    display: flex;
    gap: 8px;
}

.tutor-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--tutor-border);
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    background: var(--tutor-bg);
    color: var(--tutor-text);
}

.tutor-input:focus {
    border-color: #34C759;
}

.tutor-send-button {
    padding: 10px 18px;
    background: #34C759;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}

.tutor-send-button:hover {
    background: #2DB04D;
}

.tutor-send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.tutor-loading {
    display: none;
    padding: 8px;
    text-align: center;
    color: var(--tutor-text-light);
    font-size: 12px;
}

.tutor-loading.active {
    display: block;
}

.tutor-typing {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: var(--tutor-bg);
    border: 1px solid var(--tutor-border);
    border-radius: 14px;
    width: fit-content;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.tutor-typing span {
    width: 8px;
    height: 8px;
    background: #34C759;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Quick Actions */
.tutor-quick-actions {
    background: var(--tutor-bg);
    border: 1px solid var(--tutor-border);
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.quick-action-title {
    font-size: 13px;
    font-weight: 600;
    color: #34C759;
    margin-bottom: 12px;
}

.quick-action-btn {
    display: block;
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 8px;
    background: var(--tutor-bg);
    border: 2px solid var(--tutor-border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--tutor-text);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.quick-action-btn:last-child {
    margin-bottom: 0;
}

.quick-action-btn:hover {
    border-color: #34C759;
    background: #f0fdf4;
    transform: translateX(2px);
}

.quick-action-btn:active {
    transform: scale(0.98);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .tutor-window {
        width: calc(100vw - 40px);
        height: 600px;
        bottom: 80px;
        right: 20px;
    }
}

@media (max-width: 480px) {
    .tutor-window {
        width: calc(100vw - 20px);
        height: 500px;
        bottom: 70px;
        right: 10px;
    }

    .quick-action-btn {
        font-size: 12px;
        padding: 8px 12px;
    }
}
