/* ChatGPT Section Styles */
#chatgpt {
    background: linear-gradient(-45deg, 
        rgba(10, 15, 30, 0.95), 
        rgba(15, 25, 45, 0.98), 
        rgba(20, 30, 50, 0.95), 
        rgba(10, 20, 40, 0.98));
    background-size: 400% 400%;
    animation: backgroundWave 18s ease infinite;
    position: relative;
    overflow: hidden;
    color: #ffffff;
}

#chatgpt::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 200, 0.1), transparent);
    animation: shimmerEffect 6s infinite;
    z-index: 1;
}

#chatgpt .container {
    position: relative;
    z-index: 2;
}

/* AI Features Styling */
.ai-features {
    margin-top: 2rem;
}

.feature-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateX(-30px);
}

.feature-item.visible {
    opacity: 1;
    transform: translateX(0);
    border-left-color: #00ff88;
    padding-left: 20px;
}

.feature-item i {
    font-size: 1.2rem;
    margin-right: 15px !important;
    animation: iconPulse 2s ease-in-out infinite;
}

.feature-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding-left: 25px;
    transform: translateX(10px);
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* AI Visual Container */
.ai-visual-container {
    position: relative;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
}

/* Neural Network Animation */
.ai-brain-animation {
    position: relative;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 255, 200, 0.1), rgba(0, 123, 255, 0.1));
    border: 2px solid rgba(0, 255, 200, 0.3);
    animation: brainPulse 3s ease-in-out infinite;
    overflow: hidden;
}

.neural-network {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.node {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #00ff88;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.8);
    animation: nodeGlow 2s ease-in-out infinite alternate;
}

.node-1 { top: 20%; left: 20%; animation-delay: 0s; }
.node-2 { top: 20%; right: 20%; animation-delay: 0.4s; }
.node-3 { top: 50%; left: 10%; animation-delay: 0.8s; }
.node-4 { top: 50%; right: 10%; animation-delay: 1.2s; }
.node-5 { bottom: 20%; left: 50%; animation-delay: 1.6s; }

.connection {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 136, 0.6), transparent);
    animation: connectionFlow 3s ease-in-out infinite;
}

.conn-1 {
    top: 22%;
    left: 25%;
    width: 50%;
    transform: rotate(0deg);
    animation-delay: 0.2s;
}

.conn-2 {
    top: 40%;
    left: 15%;
    width: 70%;
    transform: rotate(45deg);
    animation-delay: 0.6s;
}

.conn-3 {
    top: 60%;
    left: 20%;
    width: 60%;
    transform: rotate(-45deg);
    animation-delay: 1s;
}

.conn-4 {
    top: 70%;
    left: 30%;
    width: 40%;
    transform: rotate(0deg);
    animation-delay: 1.4s;
}

@keyframes brainPulse {
    0%, 100% {
        transform: scale(1);
        border-color: rgba(0, 255, 200, 0.3);
    }
    50% {
        transform: scale(1.05);
        border-color: rgba(0, 255, 200, 0.6);
    }
}

@keyframes nodeGlow {
    0% {
        box-shadow: 0 0 15px rgba(0, 255, 136, 0.8);
        transform: scale(1);
    }
    100% {
        box-shadow: 0 0 25px rgba(0, 255, 136, 1);
        transform: scale(1.2);
    }
}

@keyframes connectionFlow {
    0% {
        background: linear-gradient(90deg, transparent, transparent, transparent);
    }
    50% {
        background: linear-gradient(90deg, transparent, rgba(0, 255, 136, 0.8), transparent);
    }
    100% {
        background: linear-gradient(90deg, transparent, transparent, transparent);
    }
}

/* AI Text Overlay */
.ai-text-overlay {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.typing-indicator {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #00ff88;
    border-radius: 50%;
    margin: 0 2px;
    animation: typing 1.5s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.ai-message {
    color: #00ff88;
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    animation: messageGlow 2s ease-in-out infinite alternate;
}

@keyframes messageGlow {
    0% { text-shadow: 0 0 5px rgba(0, 255, 136, 0.5); }
    100% { text-shadow: 0 0 15px rgba(0, 255, 136, 0.8); }
}

/* Chat Demo Button */
.btn-modern {
    background: linear-gradient(45deg, #00ff88, #007bff);
    border: none;
    color: white;
    padding: 12px 30px;
    border-radius: 25px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn-modern:hover::before {
    left: 100%;
}

.btn-modern:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 255, 136, 0.3);
}

/* Chat Modal */
.chat-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    z-index: 99999;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: modalBackdropFadeIn 0.3s ease-out;
}

.chat-modal.show {
    display: block !important;
}

.chat-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95%;
    max-width: 520px;
    height: 85vh;
    max-height: 700px;
    min-height: 500px;
    background: linear-gradient(145deg, 
        rgba(15, 25, 45, 0.98), 
        rgba(10, 20, 40, 0.99));
    border-radius: 24px;
    border: 2px solid rgba(0, 255, 136, 0.25);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(0, 255, 136, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    visibility: visible;
    opacity: 1;
    z-index: 100000;
}

@keyframes modalBackdropFadeIn {
    0% { 
        opacity: 0; 
    }
    100% { 
        opacity: 1; 
    }
}

@keyframes modalSlideIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -65%) scale(0.85) rotateX(15deg);
    }
    50% {
        opacity: 0.8;
        transform: translate(-50%, -52%) scale(1.02) rotateX(0deg);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotateX(0deg);
    }
}

.chat-header {
    background: linear-gradient(135deg, 
        rgba(0, 255, 136, 0.15), 
        rgba(0, 123, 255, 0.1));
    padding: 24px 28px;
    border-bottom: 1px solid rgba(0, 255, 136, 0.25);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    backdrop-filter: blur(10px);
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(0, 255, 136, 0.5), 
        transparent);
}

.chat-header h4 {
    color: #00ff88;
    margin: 0;
    font-family: 'Orbitron', 'Space Grotesk', monospace;
    font-size: 1.1rem;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-header h4 i {
    animation: pulse 2s ease-in-out infinite;
}

.close-chat {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.3);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    color: #ff4757;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-chat:hover {
    background: rgba(255, 71, 87, 0.2);
    border-color: rgba(255, 71, 87, 0.5);
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 71, 87, 0.3);
}

.chat-messages {
    flex: 1;
    padding: 24px 28px;
    overflow-y: auto;
    overflow-x: hidden;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.1);
    position: relative;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.3);
    border-radius: 3px;
    transition: background 0.3s ease;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 136, 0.5);
}

.message {
    margin-bottom: 18px;
    padding: 16px 20px;
    border-radius: 20px;
    max-width: 85%;
    word-wrap: break-word;
    line-height: 1.6;
    font-size: 0.95rem;
    animation: messageSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    white-space: pre-line;
}

.message strong {
    color: #00ff88;
    font-weight: 600;
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.3);
}

.message em {
    color: #007bff;
    font-style: italic;
}

.message code {
    background: rgba(0, 255, 136, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Orbitron', monospace;
    font-size: 0.9em;
    border: 1px solid rgba(0, 255, 136, 0.2);
}

.bullet-point {
    margin: 8px 0;
    padding-left: 12px;
    color: #e8f5e8;
    font-size: 0.92rem;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.bullet-point::before {
    content: '';
    width: 4px;
    height: 4px;
    background: #00ff88;
    border-radius: 50%;
    margin-top: 8px;
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(0, 255, 136, 0.5);
}

.ai-message-bubble .bullet-point {
    border-left: 2px solid rgba(0, 255, 136, 0.3);
    padding-left: 16px;
    margin-left: 8px;
    background: rgba(0, 255, 136, 0.05);
    border-radius: 8px;
    padding: 8px 16px;
}

.message-section {
    margin: 12px 0;
    padding: 8px 0;
}

.message-section:first-child {
    margin-top: 0;
}

.message-section:last-child {
    margin-bottom: 0;
}

.ai-message-bubble {
    background: linear-gradient(135deg, 
        rgba(0, 255, 136, 0.12), 
        rgba(0, 255, 136, 0.08));
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-left: 4px solid #00ff88;
    color: #e8f5e8;
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.1);
}

.ai-message-bubble::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 50%;
    background: linear-gradient(to bottom, #00ff88, #007bff);
    border-radius: 2px;
}

.user-message-bubble {
    background: linear-gradient(135deg, 
        rgba(0, 123, 255, 0.12), 
        rgba(0, 123, 255, 0.08));
    border: 1px solid rgba(0, 123, 255, 0.2);
    border-right: 4px solid #007bff;
    margin-left: auto;
    text-align: right;
    color: #e8f0ff;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.1);
}

.user-message-bubble::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 50%;
    background: linear-gradient(to bottom, #007bff, #00ff88);
    border-radius: 2px;
}

@keyframes messageSlideIn {
    0% {
        opacity: 0;
        transform: translateY(25px) scale(0.95);
        filter: blur(2px);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-2px) scale(1.01);
        filter: blur(0);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.chat-input-container {
    padding: 24px 28px;
    border-top: 1px solid rgba(0, 255, 136, 0.25);
    background: linear-gradient(135deg, 
        rgba(0, 0, 0, 0.1), 
        rgba(0, 255, 136, 0.02));
    display: flex;
    align-items: flex-end;
    gap: 12px;
    backdrop-filter: blur(10px);
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(0, 255, 136, 0.25);
    border-radius: 25px;
    padding: 14px 22px;
    color: #ffffff;
    font-family: 'Inter', 'Poppins', sans-serif;
    font-size: 0.95rem;
    line-height: 1.4;
    resize: none;
    min-height: 24px;
    max-height: 120px;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

.chat-input:focus {
    outline: none;
    border-color: #00ff88;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 
        0 0 0 3px rgba(0, 255, 136, 0.15),
        0 0 20px rgba(0, 255, 136, 0.2),
        inset 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.send-btn {
    background: linear-gradient(135deg, #00ff88, #007bff);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 
        0 4px 12px rgba(0, 255, 136, 0.2),
        0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.send-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent);
    transition: left 0.6s ease;
}

.send-btn:hover::before {
    left: 100%;
}

.send-btn:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 
        0 8px 20px rgba(0, 255, 136, 0.4),
        0 4px 8px rgba(0, 0, 0, 0.2);
}

.send-btn:active {
    transform: scale(1.05) translateY(-1px);
}

.send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Loading States & Accessibility */
.chat-input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.03);
}

.typing-indicator-enhanced {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    margin: 10px 0;
    background: rgba(0, 255, 136, 0.1);
    border-radius: 20px;
    border-left: 3px solid #00ff88;
    animation: fadeInUp 0.3s ease-out;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #00ff88;
    border-radius: 50%;
    animation: typingPulse 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingPulse {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.7;
    }
    30% {
        transform: scale(1.3);
        opacity: 1;
    }
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(15px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced Focus States */
.chat-modal:focus-within {
    box-shadow: 0 0 0 4px rgba(0, 255, 136, 0.1);
}

/* Smooth Transitions for All Elements */
.chat-modal *, 
.chat-modal *::before, 
.chat-modal *::after {
    transition: all 0.3s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chatgpt-section {
        padding: 60px 20px;
    }
    
    .section-title {
        font-size: 2.5rem;
        margin-bottom: 40px;
    }
    
    .section-subtitle {
        font-size: 1.1rem;
    }
    
    .feature-card {
        padding: 30px 20px;
    }
    
    .ai-visual-container {
        height: 300px;
    }
    
    .ai-brain-animation {
        width: 250px;
        height: 250px;
    }
    
    .chat-modal-content {
        width: 95%;
        height: 85vh;
        margin: 7.5vh auto;
        border-radius: 18px;
    }
    
    .chat-header {
        padding: 20px 24px;
    }
    
    .chat-messages {
        padding: 20px 24px;
    }
    
    .chat-input-container {
        padding: 20px 24px;
    }
    
    .message {
        padding: 14px 18px;
        font-size: 0.92rem;
        max-width: 90%;
    }
    
    .feature-item {
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .neural-network {
        height: 200px;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .ai-brain-animation {
        width: 200px;
        height: 200px;
    }
    
    .chat-modal-content {
        width: 98%;
        height: 90vh;
        margin: 5vh auto;
        border-radius: 15px;
    }
    
    .chat-header {
        padding: 18px 20px;
    }
    
    .chat-header h4 {
        font-size: 1rem;
    }
    
    .chat-messages {
        padding: 16px 20px;
    }
    
    .chat-input-container {
        padding: 18px 20px;
    }
    
    .message {
        padding: 12px 16px;
        font-size: 0.9rem;
        max-width: 95%;
    }
    
    .feature-item {
        font-size: 0.85rem;
    }
    
    .feature-item i {
        font-size: 1rem;
    }
    
    .send-btn {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }
}

/* High DPI Display Optimization */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .chat-modal-content {
        border-width: 1px;
    }
    
    .message {
        border-width: 1px;
    }
}

/* Reduced Motion Accessibility */
@media (prefers-reduced-motion: reduce) {
    .chat-modal-content,
    .message,
    .send-btn,
    .close-chat {
        animation: none !important;
        transition: none !important;
    }
    
    .typing-dot {
        animation: none !important;
    }
}

/* Modal Debug & Force Visibility */
.chat-modal.show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.chat-modal.show .chat-modal-content {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Force modal above all elements */
.chat-modal {
    position: fixed !important;
    z-index: 999999 !important;
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .chat-modal {
        background: rgba(0, 0, 0, 0.9);
    }
    
    .chat-modal-content {
        background: linear-gradient(145deg, 
            rgba(8, 15, 25, 0.98), 
            rgba(5, 12, 22, 0.99));
        border-color: rgba(0, 255, 136, 0.3);
    }
}
