/* Hero Actions Styling */
.hero-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hero-actions .ai-chat-btn {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-color-hover) 100%) !important;
    color: white !important;
    border: 2px solid var(--accent-color) !important;
    border-radius: 12px;
    padding: 16px 28px !important;
    font-size: 16px !important;
    font-weight: 600;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    transform: none !important;
    box-sizing: border-box !important;
    min-width: fit-content;
    white-space: nowrap;
}

.hero-actions .ai-chat-btn:hover {
    border-color: var(--accent-color-hover) !important;
    color: white !important;
}

.hero-actions .ai-chat-btn:active {
    border-color: var(--accent-color-hover) !important;
}

.hero-actions .ai-chat-btn i {
    font-size: 18px;
}

/* Code Together Button - Matching AI Button Style */
.hero-actions .code-together-btn {
    background: transparent !important;
    color: var(--accent-color) !important;
    border: 2px solid var(--accent-color) !important;
    border-radius: 12px;
    padding: 16px 28px !important;
    font-size: 16px !important;
    font-weight: 600;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    transform: none !important;
    box-sizing: border-box !important;
    min-width: fit-content;
    white-space: nowrap;
}

.hero-actions .code-together-btn:hover {
    background: var(--accent-color) !important;
    color: white !important;
    border-color: var(--accent-color-hover) !important;
}

.hero-actions .code-together-btn:active {
    border-color: var(--accent-color-hover) !important;
}

.hero-actions .code-together-btn i {
    font-size: 18px;
}

/* AI Introduction Section - Compact Version */

.ai-intro-container {
    margin-top: 25px;
    width: 100%;
    max-width: 100%;
    position: relative;
}

.home-content .ai-intro-container {
    margin-top: 30px;
    max-width: 100%;
    width: 100%;
}

.ai-intro-card {
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: 0 4px 20px rgba(0, 169, 255, 0.1);
    transition: all 0.3s ease;
}

.ai-intro-card:hover {
    border-color: var(--accent-color);
}

.ai-intro-content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.ai-avatar-small {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-color-hover) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 169, 255, 0.3);
}

.ai-intro-text h3 {
    font-size: 18px;
    margin: 0 0 8px 0; /* Inherits from base.css heading styles */
}

.ai-intro-text p {
    color: var(--paragraph-color);
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    opacity: 0.9;
}

.ai-chat-btn {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-color-hover) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 169, 255, 0.3);
    flex-shrink: 0;
}

.ai-chat-btn:hover {
    border-color: var(--accent-color-hover);
}

.ai-chat-btn:active {
    border-color: var(--accent-color-hover);
}

/* AI Modal Styles */

.ai-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.ai-modal.active {
    display: flex;
    opacity: 1;
    visibility: visible;
    align-items: center;
    justify-content: center;
}

.ai-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1;
}

.ai-modal-container {
    position: relative;
    width: 95%;
    max-width: 700px;
    max-height: 85vh;
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 169, 255, 0.25);
    animation: modalSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2;
    margin: 20px;
    margin-top: 100px;
}

.ai-modal-header {
    background: linear-gradient(135deg, 
        rgba(0, 169, 255, 0.1) 0%, 
        rgba(0, 169, 255, 0.05) 100%);
    border-bottom: 1px solid var(--card-border);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(10px);
}

.ai-modal-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-modal-title .ai-avatar {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-color-hover) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    box-shadow: 0 4px 15px rgba(0, 169, 255, 0.3);
}

.ai-modal-title h3 {
    color: var(--title-color);
    font-size: 20px;
    margin: 0; /* Inherits from base.css heading styles */
}

.ai-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 71, 87, 0.1);
    border: 2px solid transparent;
    color: #ff4757;
    font-size: 18px;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.ai-modal-close:hover {
    border-color: #ff4757;
    color: #ff4757;
}

.ai-modal-title h3 {
    font-size: 18px;
    margin: 0; /* Inherits from base.css heading styles */
}

.ai-modal-close {
    background: none;
    border: none;
    color: var(--paragraph-color);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-modal-close:hover {
    color: #ff4757;
}

/* Modal Animation */
@keyframes modalSlideIn {
    from {
        transform: scale(0.9) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Modal Chat Interface - Enhanced for mobile */

.ai-modal .ai-chat-interface {
    background: var(--card-bg);
    border: none;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    height: calc(85vh - 120px);
    min-height: 400px;
}

.ai-modal .ai-chat-messages {
    flex: 1;
    max-height: none;
    min-height: auto;
    overflow-y: auto;
    padding: 32px 24px; /* Increased top/bottom padding from 24px */
    background: linear-gradient(135deg, 
        rgba(0, 169, 255, 0.02) 0%, 
        rgba(0, 169, 255, 0.05) 50%, 
        rgba(0, 169, 255, 0.02) 100%);
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Hide modal scrollbar for Webkit browsers */
.ai-modal .ai-chat-messages::-webkit-scrollbar {
    display: none;
}

.ai-modal .ai-query-form {
    border-top: 1px solid var(--card-border);
    padding: 24px; /* Increased from 20px 24px */
    background: rgba(0, 169, 255, 0.02);
    backdrop-filter: blur(5px);
}

/* Original Chat Interface Styles (for modal) */

.ai-query-container {
    margin-top: 25px;
    width: 100%;
    max-width: 100%;
    position: relative;
}

/* Integration with home page hero section */
.home-content .ai-query-container {
    margin-top: 30px;
    max-width: 100%;
    width: 100%;
}

.ai-chat-interface {
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 169, 255, 0.1);
    transition: all 0.3s ease;
    max-width: 100%;
}

.ai-chat-interface:hover {
    border-color: var(--accent-color);
    box-shadow: 0 12px 40px rgba(0, 169, 255, 0.15);
}

/* Chat Messages Area */
.ai-chat-messages {
    max-height: 300px;
    min-height: 120px;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(135deg, 
        rgba(0, 169, 255, 0.02) 0%, 
        rgba(0, 169, 255, 0.05) 50%, 
        rgba(0, 169, 255, 0.02) 100%);
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Hide scrollbar for Webkit browsers */
.ai-chat-messages::-webkit-scrollbar {
    display: none;
}

/* Welcome Message */
.welcome-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 20px; /* Increased from 16px */
    background: linear-gradient(135deg, 
        rgba(0, 169, 255, 0.1) 0%, 
        rgba(0, 169, 255, 0.05) 100%);
    border-radius: 12px;
    border: 1px solid rgba(0, 169, 255, 0.2);
    animation: fadeInUp 0.6s ease-out;
    margin-bottom: 24px; /* Added margin for separation */
}

.ai-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-color-hover) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 169, 255, 0.3);
}

.message-content {
    flex: 1;
}

.message-content p {
    color: var(--title-color);
    font-size: 15px;
    line-height: 1.5;
    margin: 0;
    font-weight: 500;
}

/* User and AI Messages */
.user-message, .ai-message {
    display: flex;
    margin-bottom: 24px; /* Increased from 16px */
    animation: fadeInUp 0.4s ease-out;
}

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

.user-message .message-bubble {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-color-hover) 100%);
    color: white;
    border-radius: 18px 18px 4px 18px;
    max-width: 70%;
}

.ai-message .message-bubble {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--title-color);
    border-radius: 18px 18px 18px 4px;
    max-width: 80%;
}

.message-bubble {
    padding: 16px 20px; /* Increased from 12px 16px */
    font-size: 14px;
    line-height: 1.5; /* Increased from 1.4 */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 4px 0; /* Added margin for extra breathing room */
}

/* WhatsApp-style message formatting */
.message-bubble strong {
    font-weight: 600;
    color: var(--accent-color);
}

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

.message-bubble br {
    line-height: 1.8;
}

/* Emoji and special character spacing */
.message-bubble {
    word-spacing: 2px;
}

/* Bullet points styling */
.ai-message .message-bubble {
    white-space: pre-line; /* Preserve line breaks */
}

/* Input Form Area */
.ai-query-form {
    padding: 16px 20px;
    background: var(--card-bg);
    border-top: 1px solid var(--card-border);
}

.input-container {
    display: flex;
    align-items: flex-end;
    gap: 16px; /* Increased from 12px */
    background: rgba(0, 169, 255, 0.05);
    border: 2px solid var(--card-border);
    border-radius: 12px;
    padding: 16px 20px; /* Increased from 12px 16px */
    transition: all 0.3s ease;
    position: relative;
    margin-top: 8px; /* Added top margin for separation */
}

.input-container:focus-within {
    border-color: var(--accent-color);
    background: rgba(0, 169, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(0, 169, 255, 0.1);
}

.textarea-container {
    flex: 1;
    position: relative;
}

.textarea-container textarea {
    width: 100%;
    border: none;
    background: transparent;
    outline: none;
    color: var(--title-color);
    font-size: 16px;
    font-family: var(--paragraph-font);
    padding: 16px 20px;
    line-height: 1.5;
    resize: none;
    overflow-y: auto;
    min-height: 75px;
    max-height: 140px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Hide textarea scrollbar for Webkit browsers */
.textarea-container textarea::-webkit-scrollbar {
    display: none;
}

.textarea-container textarea::placeholder {
    color: var(--paragraph-color);
    font-style: italic;
    opacity: 0.7;
}

.char-count {
    position: absolute;
    bottom: 4px;
    right: 8px;
    font-size: 10px;
    color: var(--paragraph-color);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.textarea-container:focus-within .char-count {
    opacity: 1;
}

/* Buttons */
.action-btn, .submit-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 8px;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.left-btn {
    color: var(--paragraph-color);
    background: rgba(0, 169, 255, 0.1);
}

.left-btn:hover {
    color: var(--accent-color);
    background: rgba(0, 169, 255, 0.15);
}

.submit-btn {
    background: var(--accent-color);
    color: white;
    border: 2px solid var(--accent-color);
}

.submit-btn:hover {
    border-color: var(--accent-color-hover);
    background: var(--accent-color-hover);
}

.submit-btn:active {
    border-color: var(--accent-color-hover);
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* File Display */
#file-display-container {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.file-display-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(0, 169, 255, 0.15) 0%, rgba(0, 169, 255, 0.08) 100%);
    border: 1px solid rgba(0, 169, 255, 0.3);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--accent-color);
    font-weight: 500;
}

.file-display-item .remove-file {
    cursor: pointer;
    color: var(--paragraph-color);
    font-size: 14px;
    transition: color 0.3s ease;
}

.file-display-item .remove-file:hover {
    color: #ff4757;
}

/* Loading States */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 18px 18px 18px 4px;
    max-width: 80px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: typingDots 1.4s infinite ease-in-out;
}

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

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

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typingDots {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .ai-intro-card {
        flex-direction: column;
        text-align: center;
        gap: 16px;
        padding: 16px;
    }
    
    .ai-intro-content {
        flex-direction: column;
        gap: 12px;
    }
    
    .ai-avatar-small {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .ai-intro-text h3 {
        font-size: 16px;
    }
    
    .ai-intro-text p {
        font-size: 13px;
    }
    
    .ai-chat-btn {
        padding: 10px 16px;
        font-size: 13px;
        width: 100%;
        justify-content: center;
    }
    
    .ai-modal-container {
        width: 98%;
        max-width: none;
        max-height: 90vh;
        margin: 10px;
        border-radius: 16px;
    }
    
    .ai-modal-header {
        padding: 16px 20px;
    }
    
    .ai-modal-title h3 {
        font-size: 18px;
    }
    
    .ai-modal-title .ai-avatar {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .ai-modal .ai-chat-interface {
        height: calc(90vh - 100px);
        min-height: 350px;
    }
    
    .ai-modal .ai-chat-messages {
        padding: 20px;
    }
    
    .ai-modal .ai-query-form {
        padding: 16px 20px;
    }
    
    .ai-modal .input-container {
        padding: 10px 14px;
        border-radius: 20px;
    }
    
    .ai-modal .textarea-container textarea {
        font-size: 16px;
        padding: 14px 16px;
        min-height: 52px;
    }
    
    .ai-modal .attach-btn, .ai-modal .submit-btn {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
    
    .welcome-message, .user-message, .ai-response {
        padding: 12px 16px;
        margin-bottom: 12px;
    }
    
    .message-content {
        font-size: 14px;
        line-height: 1.5;
    }
}

/* Extra Small Mobile Devices */
@media (max-width: 480px) {
    .hero-actions .ai-chat-btn {
        padding: 14px 18px;
        font-size: 15px;
    }
    
    .ai-modal-container {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    .ai-modal-header {
        padding: 12px 16px;
    }
    
    .ai-modal-title h3 {
        font-size: 16px;
    }
    
    .ai-modal-title .ai-avatar {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .ai-modal .ai-chat-interface {
        height: calc(100vh - 80px);
        min-height: auto;
    }
    
    .ai-modal .ai-chat-messages {
        padding: 16px;
    }
    
    .ai-modal .ai-query-form {
        padding: 12px 16px;
    }
    
    .welcome-message, .user-message, .ai-response {
        padding: 10px 12px;
        margin-bottom: 10px;
    }
    
    .message-content {
        font-size: 13px;
    }
}
    
    .ai-modal .attach-btn, 
    .ai-modal .submit-btn {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .ai-modal .textarea-container textarea {
        font-size: 14px;
        padding: 10px 14px;
        min-height: 40px;
        max-height: 100px;
    }
    
    .ai-modal .welcome-message {
        padding: 12px;
    }
    
    .ai-modal .ai-avatar {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .ai-modal .message-content p {
        font-size: 14px;
    }
    
    .ai-modal .user-message .message-bubble,
    .ai-modal .ai-message .message-bubble {
        max-width: 85%;
    }

@media (max-width: 480px) {
    .ai-intro-card {
        padding: 14px;
        border-radius: 12px;
    }
    
    .ai-avatar-small {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .ai-intro-text h3 {
        font-size: 15px;
    }
    
    .ai-intro-text p {
        font-size: 12px;
    }
    
    .ai-modal-container {
        width: 98%;
        max-height: 90vh;
        border-radius: 12px;
    }
    
    .ai-modal .ai-chat-interface {
        border-radius: 0;
    }
    
    .ai-modal .ai-chat-messages {
        max-height: 250px;
        padding: 12px;
    }
    
    .ai-modal .input-container {
        gap: 8px;
    }
    
    .ai-modal .textarea-container textarea {
        padding: 8px 12px;
    }
}

/* Additional spacing improvements for modal */
.ai-modal .ai-chat-messages > *:first-child {
    margin-top: 8px; /* Extra space at the top */
}

.ai-modal .ai-chat-messages > *:last-child {
    margin-bottom: 16px; /* Extra space at the bottom */
}

/* Ensure proper spacing between consecutive AI messages */
.ai-message + .ai-message {
    margin-top: 8px;
}

.user-message + .user-message {
    margin-top: 8px;
}

/* Extra spacing when switching between user and AI messages */
.user-message + .ai-message,
.ai-message + .user-message {
    margin-top: 4px;
}

/* Keyboard hint styling */
.keyboard-hint {
    margin-top: 8px;
    text-align: center;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.keyboard-hint small {
    color: var(--text-color);
    font-size: 12px;
}

.keyboard-hint kbd {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    font-family: monospace;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    margin: 0 2px;
}

/* Show hint more prominently when textarea is focused */
.textarea-container textarea:focus + .char-count + .keyboard-hint {
    opacity: 1;
}

/* Hide hint on very small screens to save space */
@media (max-width: 480px) {
    .keyboard-hint {
        display: none;
    }
}
