/* Keyframes and animations */
@keyframes backgroundPulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.05); }
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; transform: scale(1.2); }
}

@keyframes titleGlow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.2); }
}

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

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

@keyframes aiGlow {
    0%, 100% { box-shadow: 0 0 10px rgba(156, 39, 176, 0.3); }
    50% { box-shadow: 0 0 20px rgba(156, 39, 176, 0.6); }
}

@keyframes aiTypingGlow {
    0%, 100% { box-shadow: 0 0 15px rgba(156, 39, 176, 0.5); }
    50% { box-shadow: 0 0 25px rgba(156, 39, 176, 0.8); }
}

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

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

@keyframes sendBtnPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
    50% { transform: scale(1.05); box-shadow: 0 4px 16px rgba(25, 118, 210, 0.3); }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

@keyframes bubbleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes typingBlink {
    0%, 80%, 100% {
        opacity: 0.2;
    }
    40% {
        opacity: 1;
    }
}

/* Background animations */
.chat-background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.1) 0%, transparent 50%);
    animation: backgroundPulse 20s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

.dark-mode .chat-background-animation {
    background: 
        radial-gradient(circle at 20% 80%, rgba(75, 85, 135, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 69, 145, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(85, 145, 185, 0.05) 0%, transparent 50%);
}

/* Loading container */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 80vh;
    animation: fadeIn 0.5s ease-in;
}

.loading-text {
    animation: pulse 2s ease-in-out infinite;
}

/* Chat grid and header */
.chat-grid {
    position: relative;
    z-index: 1;
}

.chat-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    margin-bottom: 1rem;
    padding: 0 1rem;
}

.header-right {
    margin-left: auto;
}

.chat-title {
    background: linear-gradient(45deg, var(--mud-palette-primary), var(--mud-palette-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleGlow 3s ease-in-out infinite;
}

.ai-status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: rgba(76, 175, 80, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4caf50;
    border-radius: 50%;
    animation: statusPulse 2s ease-in-out infinite;
}

/* Chat card improvements */
.chat-card {
    background: rgba(255,255,255,0.95);
    border-radius: 18px;
    min-height: 60vh;
    max-height: 68vh;
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    animation: cardSlideIn 0.6s ease-out;
}

.dark-mode .chat-card {
    background: rgba(30,32,36,0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Avatar animations */
.avatar-pulse {
    animation: avatarPulse 2s ease-in-out infinite;
}

.ai-avatar {
    animation: aiGlow 3s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(156, 39, 176, 0.3);
}

.ai-avatar-typing {
    animation: aiTypingGlow 1s ease-in-out infinite;
    box-shadow: 0 0 15px rgba(156, 39, 176, 0.5);
}

/* Message improvements */
.typing-message {
    animation: typingMessagePulse 1.5s ease-in-out infinite;
}

/* Chat messages */
.chat-messages {
    padding-bottom: 1rem;
    scroll-behavior: smooth;
    transition: background 0.3s;
}

.message-wrapper {
    margin-bottom: 1.5rem;
    transition: all 0.3s ease-in-out;
    animation: fadeInMessage 0.4s ease-out;
}

.user-message-wrapper {
    display: flex;
    justify-content: flex-end;
}

.ai-message-wrapper {
    display: flex;
    justify-content: flex-start;
}

.message-content {
    max-width: 75%;
    min-width: 200px;
    border-radius: 18px;
    padding: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: bubbleIn 0.3s ease-out;
}

.message-content:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.user-message {
    background: linear-gradient(135deg, var(--mud-palette-primary) 0%, var(--mud-palette-primary-darken) 100%);
    color: var(--mud-palette-primary-text);
    margin-left: auto;
    border-radius: 18px 18px 4px 18px;
}

.ai-message {
    background: linear-gradient(135deg, var(--mud-palette-background-grey) 0%, var(--mud-palette-surface) 100%);
    color: var(--mud-palette-text-primary);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 18px 18px 18px 4px;
}

.message-header {
    padding: 10px 16px 6px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.05);
    border-radius: 18px 18px 0 0;
}

.user-message .message-header {
    border-bottom-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
}

.message-body {
    padding: 14px 16px 18px 16px;
    word-wrap: break-word;
    line-height: 1.6;
    border-radius: 0 0 18px 18px;
}

/* Input area improvements */
.chat-input-area {
    padding: 1rem;
    background: rgba(255,255,255,0.95);
    border-top: 1px solid #e0e0e0;
    position: sticky;
    bottom: 0;
    z-index: 2;
    border-radius: 0 0 18px 18px;
    backdrop-filter: blur(10px);
    animation: inputSlideIn 0.5s ease-out;
    transition: all 0.3s ease;
}

.dark-mode .chat-input-area {
    background: rgba(30,32,36,0.95);
    border-top: 1px solid #333;
}

/* Enhanced focus state for better UX when typing */
.chat-input-area:focus-within {
    box-shadow: 0 -4px 16px rgba(25, 118, 210, 0.1);
    background: rgba(255,255,255,0.98);
}

.dark-mode .chat-input-area:focus-within {
    background: rgba(30,32,36,0.98);
    box-shadow: 0 -4px 16px rgba(25, 118, 210, 0.2);
}

/* Visual feedback for typing state */
.chat-input-area:has(.typing-active) {
    background: rgba(255,255,255,0.99);
    border-top-color: rgba(25, 118, 210, 0.2);
}

.dark-mode .chat-input-area:has(.typing-active) {
    background: rgba(30,32,36,0.99);
    border-top-color: rgba(25, 118, 210, 0.3);
}

/* Chat input improvements */
.chat-input {
    flex: 1;
    transition: all 0.4s ease-in-out;
    min-height: 48px;
}

.chat-input .mud-input-root {
    transition: all 0.4s ease-in-out;
}

.chat-input .mud-input-root-multiline {
    transition: min-height 0.4s ease-in-out, max-height 0.4s ease-in-out;
}

/* Enhanced styling for text area states */
.chat-input textarea {
    transition: height 0.3s ease-in-out, min-height 0.3s ease-in-out, box-shadow 0.3s ease;
    resize: none;
}

.chat-input textarea.focused {
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.2);
}

.chat-input textarea.typing-active {
    background-color: rgba(25, 118, 210, 0.02);
    border-color: rgba(25, 118, 210, 0.3);
}

.dark-mode .chat-input textarea.typing-active {
    background-color: rgba(25, 118, 210, 0.05);
}

/* Dark theme support */
.dark-mode .message-content {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.dark-mode .ai-message {
    background: linear-gradient(135deg, var(--mud-palette-background-grey) 0%, var(--mud-palette-surface) 100%);
    border-color: var(--mud-palette-lines-default);
}

/* Interview Instructions Popup Styles */
.interview-instructions-overlay {
    z-index: 9999;
    backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.6) !important;
}

.interview-instructions-popup {
    max-width: 600px;
    width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    margin: auto;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2), 0 8px 30px rgba(0, 0, 0, 0.1);
    animation: popupSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.dark-mode .interview-instructions-popup {
    background: linear-gradient(135deg, #1e2024 0%, #2a2d36 100%);
    border-color: rgba(255, 255, 255, 0.1);
}

@keyframes popupSlideIn {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(30px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px 16px 32px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: linear-gradient(135deg, rgba(25, 118, 210, 0.05) 0%, rgba(25, 118, 210, 0.02) 100%);
    border-radius: 24px 24px 0 0;
}

.dark-mode .popup-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, rgba(25, 118, 210, 0.1) 0%, rgba(25, 118, 210, 0.05) 100%);
}

.popup-icon {
    font-size: 2rem !important;
    color: var(--mud-palette-primary);
    margin-right: 16px;
    animation: iconPulse 2s infinite;
}

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

.popup-title {
    flex: 1;
    font-weight: 600 !important;
    color: var(--mud-palette-text-primary);
    margin: 0 !important;
}

.popup-close-btn {
    opacity: 0.7;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.popup-close-btn:hover {
    opacity: 1;
    transform: rotate(90deg);
}

.popup-content {
    padding: 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.instruction-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    animation: instructionFadeIn 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

.dark-mode .instruction-item {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.instruction-item:nth-child(1) { animation-delay: 0.1s; }
.instruction-item:nth-child(2) { animation-delay: 0.2s; }
.instruction-item:nth-child(3) { animation-delay: 0.3s; }
.instruction-item:nth-child(4) { animation-delay: 0.4s; }
.instruction-item:nth-child(5) { animation-delay: 0.5s; }

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

.instruction-item:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.dark-mode .instruction-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.instruction-icon {
    font-size: 1.5rem !important;
    margin-top: 4px;
    flex-shrink: 0;
}

.instruction-text {
    flex: 1;
}

.instruction-title {
    font-weight: 600 !important;
    margin-bottom: 8px !important;
    color: var(--mud-palette-text-primary);
}

.instruction-text .mud-typography-body1 {
    color: var(--mud-palette-text-secondary);
    line-height: 1.6;
}

.popup-footer {
    padding: 20px 32px 32px 32px;
    display: flex;
    justify-content: center;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    background: linear-gradient(135deg, rgba(25, 118, 210, 0.02) 0%, rgba(25, 118, 210, 0.01) 100%);
    border-radius: 0 0 24px 24px;
}

.dark-mode .popup-footer {
    border-top-color: rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, rgba(25, 118, 210, 0.05) 0%, rgba(25, 118, 210, 0.02) 100%);
}

.popup-start-btn {
    padding: 12px 32px !important;
    font-weight: 600 !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 16px rgba(25, 118, 210, 0.3) !important;
    transition: all 0.3s ease !important;
    animation: buttonPulse 2s infinite;
}

.popup-start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(25, 118, 210, 0.4) !important;
}

@keyframes buttonPulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(25, 118, 210, 0.3); }
    50% { box-shadow: 0 6px 20px rgba(25, 118, 210, 0.4); }
}

/* Info Button in Header */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
}

.dark-mode .chat-header {
    background: rgba(30, 32, 36, 0.95);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

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

.info-button {
    opacity: 0.7;
    transition: all 0.3s ease;
    border-radius: 50%;
    background: rgba(25, 118, 210, 0.1);
}

.info-button:hover {
    opacity: 1;
    transform: scale(1.1);
    background: rgba(25, 118, 210, 0.15);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.2);
}

.chat-title {
    margin-bottom: 0 !important;
}

/* Responsive Design for Popup */
@media (max-width: 768px) {
    .interview-instructions-popup {
        width: 95vw;
        max-height: 90vh;
        margin: 2.5vh auto;
    }
    
    .popup-header,
    .popup-content,
    .popup-footer {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .instruction-item {
        padding: 16px;
        gap: 12px;
    }
    
    .popup-icon {
        font-size: 1.5rem !important;
        margin-right: 12px;
    }
    
    .instruction-icon {
        font-size: 1.25rem !important;
    }
    
    .header-left {
        flex-direction: row;
        gap: 8px;
    }
    
    .chat-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .chat-title {
        font-size: 1.5rem !important;
    }
    
    .message-content {
        max-width: 90%;
        min-width: 150px;
    }
}

/* ChatGPT-style AI Interview Chat Styles */

/* Integration with MudBlazor theme */
.mud-theme-dark .chatgpt-input-container,
.dark-mode .chatgpt-input-container {
    background: rgba(32, 33, 35, 0.8) !important;
    border-color: var(--mud-palette-lines-default, #4a5568) !important;
}

.mud-theme-dark .chatgpt-input-container.focused,
.dark-mode .chatgpt-input-container.focused {
    border-color: var(--mud-palette-primary, #60a5fa) !important;
    background: rgba(32, 33, 35, 0.95) !important;
    box-shadow: 0 0 0 3px rgba(var(--mud-palette-primary-rgb, 96, 165, 250), 0.1), 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
}

.mud-theme-dark .chatgpt-textarea,
.dark-mode .chatgpt-textarea {
    color: var(--mud-palette-text-primary, #e5e7eb) !important;
}

.mud-theme-dark .chatgpt-textarea::placeholder,
.dark-mode .chatgpt-textarea::placeholder {
    color: var(--mud-palette-text-secondary, #6b7280) !important;
}

.mud-theme-dark .send-button,
.dark-mode .send-button {
    background: var(--mud-palette-background-grey, #374151) !important;
    color: var(--mud-palette-text-secondary, #9ca3af) !important;
}

.mud-theme-dark .send-button:hover:not(:disabled),
.dark-mode .send-button:hover:not(:disabled) {
    background: var(--mud-palette-action-hover, #4b5563) !important;
}

.mud-theme-dark .send-button.enabled,
.dark-mode .send-button.enabled {
    background: var(--mud-palette-primary, #60a5fa) !important;
    color: var(--mud-palette-primary-text, #1f2937) !important;
}

.mud-theme-dark .send-button.enabled:hover,
.dark-mode .send-button.enabled:hover {
    background: var(--mud-palette-primary-darken, #3b82f6) !important;
}

.mud-theme-dark .keyboard-shortcuts,
.dark-mode .keyboard-shortcuts {
    color: var(--mud-palette-text-secondary, #9ca3af) !important;
}

.mud-theme-dark kbd,
.dark-mode kbd {
    background: var(--mud-palette-background-grey, #374151) !important;
    border-color: var(--mud-palette-lines-default, #4b5563) !important;
    color: var(--mud-palette-text-primary, #e5e7eb) !important;
}

/* ChatGPT-style Input Container */
.chatgpt-input-container {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-top: 16px;
    padding: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    min-height: 60px;
}

.chatgpt-input-container.focused {
    border-color: var(--mud-palette-primary, #3b82f6);
    box-shadow: 0 0 0 3px rgba(var(--mud-palette-primary-rgb, 59, 130, 246), 0.1), 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.95);
}

/* Typing expansion - 4x height increase */
.chatgpt-input-container.typing-expanded {
    min-height: 240px !important; /* 4x expansion from 60px */
    max-height: 300px !important;
    transform: scale(1.01);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border-color: var(--mud-palette-primary, #3b82f6);
    background: rgba(255, 255, 255, 0.98);
    /* Auto-scroll to bottom when expanded */
    scroll-margin-bottom: 20px;
}

.chatgpt-input-container.typing-expanded .chatgpt-textarea {
    min-height: 180px !important; /* Allow textarea to grow within container */
    max-height: 250px !important;
    font-size: 16px;
    line-height: 1.6;
}

/* AI responding - minimized textarea */
.chatgpt-input-container.ai-responding {
    min-height: 60px !important;
    max-height: 80px !important;
    opacity: 0.8;
    transform: scale(0.99);
}

.chatgpt-input-container.ai-responding .chatgpt-textarea {
    min-height: 40px !important;
    max-height: 40px !important;
    opacity: 0.7;
}

/* Normal state */
.chatgpt-input-container.normal-state {
    min-height: 60px !important;
    max-height: 200px !important; /* Fixed max-height for normal state */
}

.chatgpt-input-container.normal-state .chatgpt-textarea {
    min-height: 40px !important;
    max-height: 200px !important; /* Fixed max-height for normal state */
}

/* Message container adjustments */
.chat-messages.compressed-for-typing {
    max-height: calc(100vh - 400px) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-messages.compressed-for-ai {
    max-height: calc(100vh - 180px) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-messages.normal-height {
    max-height: calc(100vh - 250px) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-wrapper {
    position: relative;
}

.textarea-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    position: relative;
}

/* ChatGPT-style Textarea */
.chatgpt-textarea {
    flex: 1;
    resize: none;
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.5;
    color: var(--mud-palette-text-primary, #374151);
    padding: 12px 16px;
    max-height: 200px; /* Default max-height */
    min-height: 40px;
    overflow-y: auto;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatgpt-textarea::placeholder {
    color: var(--mud-palette-text-secondary, #9ca3af);
    transition: opacity 0.2s ease;
}

.chatgpt-textarea.focused::placeholder {
    opacity: 0.7;
}

.chatgpt-textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Custom scrollbar for textarea */
.chatgpt-textarea::-webkit-scrollbar {
    width: 4px;
}

.chatgpt-textarea::-webkit-scrollbar-track {
    background: transparent;
}

.chatgpt-textarea::-webkit-scrollbar-thumb {
    background: var(--mud-palette-text-disabled, #d1d5db);
    border-radius: 2px;
}

.mud-theme-dark .chatgpt-textarea::-webkit-scrollbar-thumb,
.dark-mode .chatgpt-textarea::-webkit-scrollbar-thumb {
    background: var(--mud-palette-text-disabled, #4b5563);
}

/* Input Actions */
.input-actions {
    display: flex;
    align-items: flex-end;
    padding-bottom: 4px;
}

/* ChatGPT-style Send Button */
.send-button {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.send-button:hover:not(:disabled) {
    background: #e5e7eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.send-button.enabled {
    background: var(--mud-palette-primary, #3b82f6);
    color: white;
    animation: buttonPulse 0.3s ease-out;
}

.send-button.enabled:hover {
    background: var(--mud-palette-primary-darken, #2563eb);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(var(--mud-palette-primary-rgb, 59, 130, 246), 0.3);
}

.send-button.loading {
    background: var(--mud-palette-primary, #3b82f6);
    color: white;
    cursor: not-allowed;
}

.send-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Send Button Content */
.send-button-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.send-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
}

.send-button.enabled .send-icon {
    transform: translateY(-1px);
}

/* Loading Spinner */
.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Keyboard Shortcuts */
.keyboard-shortcuts {
    display: flex;
    gap: 16px;
    padding: 8px 16px 4px;
    font-size: 12px;
    color: var(--mud-palette-text-secondary, #6b7280);
    animation: fadeInUp 0.2s ease-out;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

kbd {
    background: var(--mud-palette-background-grey, #f3f4f6);
    border: 1px solid var(--mud-palette-lines-default, #d1d5db);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    color: var(--mud-palette-text-primary);
}

/* Animations */
@keyframes buttonPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

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

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(8px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Focus animations */
.chatgpt-input-container:not(.focused) .keyboard-shortcuts {
    display: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .chatgpt-input-container {
        margin: 12px 8px;
        border-radius: 16px;
    }
    
    .chatgpt-input-container.typing-expanded {
        min-height: 200px !important; /* Slightly smaller on mobile */
        max-height: 250px !important;
    }
    
    .chatgpt-textarea {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 16px;
    }
    
    .send-button {
        width: 44px;
        height: 44px;
    }
    
    .keyboard-shortcuts {
        flex-direction: column;
        gap: 4px;
        font-size: 11px;
    }
    
    /* Adjust mobile compression */
    .chat-messages.compressed-for-typing {
        max-height: calc(100vh - 350px) !important;
    }
}

/* Enhanced chat message styles */
.chat-messages {
    padding-bottom: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.message-wrapper {
    margin-bottom: 16px;
    animation: messageSlideIn 0.3s ease-out;
}

.user-message-wrapper {
    display: flex;
    justify-content: flex-end;
}

.ai-message-wrapper {
    display: flex;
    justify-content: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.user-message {
    background: linear-gradient(135deg, var(--mud-palette-primary, #3b82f6), var(--mud-palette-primary-darken, #1d4ed8));
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message {
    background: rgba(255, 255, 255, 0.9);
    color: var(--mud-palette-text-primary, #374151);
    border: 1px solid var(--mud-palette-lines-default, #e5e7eb);
    border-bottom-left-radius: 4px;
}

.mud-theme-dark .ai-message,
.dark-mode .ai-message {
    background: rgba(55, 65, 81, 0.9);
    color: var(--mud-palette-text-primary, #e5e7eb);
    border-color: var(--mud-palette-lines-default, #4b5563);
}

.message-header {
    margin-bottom: 8px;
}

.message-body {
    line-height: 1.6;
}

/* Typing indicator animation */
.typing-message {
    animation: typingPulse 1.5s ease-in-out infinite;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--mud-palette-text-secondary, #6b7280);
    animation: typingDot 1.4s infinite;
}

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

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

@keyframes messageSlideIn {
    0% {
        opacity: 0;
        transform: translateY(16px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typingPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Avatar animations */
.avatar-pulse {
    animation: avatarPulse 2s infinite;
}

.ai-avatar-typing {
    animation: aiTypingGlow 1.5s ease-in-out infinite;
}

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

@keyframes aiTypingGlow {
    0%, 100% {
        box-shadow: 0 0 0 rgba(99, 102, 241, 0.4);
    }
    50% {
        box-shadow: 0 0 16px rgba(99, 102, 241, 0.6);
    }
}

/* Enhanced input focus state */
.chatgpt-textarea.focused {
    box-shadow: 0 0 0 2px rgba(var(--mud-palette-primary-rgb, 59, 130, 246), 0.2);
}

/* Smooth transitions for better UX */
.chatgpt-input-container,
.send-button,
.chatgpt-textarea {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Theme transition animations */
.chatgpt-input-container,
.chatgpt-textarea,
.send-button,
kbd {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* AI Interview Chat Timer Styles */
.header-title-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.chat-title {
    margin-bottom: 0 !important;
}

.interview-timer {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 16px;
    background-color: var(--mud-palette-success-lighten);
    color: var(--mud-palette-success-darken);
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.interview-timer.warning {
    background-color: var(--mud-palette-warning-lighten);
    color: var(--mud-palette-warning-darken);
}

.interview-timer.danger {
    background-color: var(--mud-palette-error-lighten);
    color: var(--mud-palette-error-darken);
    animation: pulse 2s infinite;
}

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

.dark-mode .interview-timer {
    background-color: rgba(76, 175, 80, 0.2);
    color: #81c784;
}

.dark-mode .interview-timer.warning {
    background-color: rgba(255, 152, 0, 0.2);
    color: #ffb74d;
}

.dark-mode .interview-timer.danger {
    background-color: rgba(244, 67, 54, 0.2);
    color: #e57373;
}