/* Custom CSS for IBAchieve */

/* Font family */
.font-inter {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Custom animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

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

.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.animate-slide-in {
    animation: slideIn 0.5s ease-out;
}

.animate-pulse-gentle {
    animation: pulse 2s infinite;
}

/* Typewriter effect for AI responses */
.typewriter {
    overflow: hidden;
    border-right: 2px solid #3B82F6;
    white-space: nowrap;
    animation: typing 3s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: #3B82F6; }
}

/* Custom scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Chat interface styles */
.chat-container {
    height: calc(100vh - 200px);
    min-height: 400px;
}

.chat-message {
    max-width: 80%;
    word-wrap: break-word;
}

.chat-message.user {
    margin-left: auto;
    background: linear-gradient(135deg, #3B82F6, #1D4ED8);
}

.chat-message.assistant {
    margin-right: auto;
    background: #F3F4F6;
    color: #374151;
}

.chat-input {
    resize: none;
    min-height: 44px;
    max-height: 120px;
}

/* Loading spinner */
.spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3B82F6;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

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

/* Math equation styles */
.math-equation {
    font-family: 'Times New Roman', serif;
    font-size: 1.1em;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 4px;
    padding: 8px 12px;
    margin: 8px 0;
    display: inline-block;
}

/* Code block styles */
.code-block {
    background: #1F2937;
    color: #F9FAFB;
    border-radius: 8px;
    padding: 16px;
    margin: 12px 0;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    line-height: 1.5;
}

.code-block pre {
    margin: 0;
    white-space: pre-wrap;
}

/* Image upload area */
.upload-area {
    border: 2px dashed #D1D5DB;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #3B82F6;
    background: #F8FAFC;
}

.upload-area.dragover {
    border-color: #3B82F6;
    background: #EBF8FF;
}

/* Progress bars */
.progress-bar {
    background: #E5E7EB;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, #3B82F6, #1D4ED8);
    height: 100%;
    border-radius: 9999px;
    transition: width 0.3s ease;
}

/* Card hover effects */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Button styles */
.btn-primary {
    background: linear-gradient(135deg, #3B82F6, #1D4ED8);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1D4ED8, #1E40AF);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background: #F3F4F6;
    border: 1px solid #D1D5DB;
    color: #374151;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #E5E7EB;
    border-color: #9CA3AF;
}

/* Form styles */
.form-input {
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 16px;
    transition: all 0.3s ease;
    width: 100%;
}

.form-input:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input.error {
    border-color: #EF4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.focus\:not-sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .chat-message.user {
        background: #000000;
        color: #FFFFFF;
        border: 2px solid #FFFFFF;
    }
    
    .chat-message.assistant {
        background: #FFFFFF;
        color: #000000;
        border: 2px solid #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .dark-mode-auto {
        background: #1F2937;
        color: #F9FAFB;
    }
    
    .dark-mode-auto .bg-white {
        background: #374151;
    }
    
    .dark-mode-auto .text-gray-900 {
        color: #F9FAFB;
    }
    
    .dark-mode-auto .text-gray-600 {
        color: #D1D5DB;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-break {
        page-break-before: always;
    }
    
    .print-avoid-break {
        page-break-inside: avoid;
    }
}

/* Mobile-specific styles */
@media (max-width: 640px) {
    .chat-message {
        max-width: 95%;
    }
    
    .upload-area {
        padding: 20px 10px;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 14px 20px;
        font-size: 16px;
    }
}

/* Tablet-specific styles */
@media (min-width: 641px) and (max-width: 1024px) {
    .chat-container {
        height: calc(100vh - 160px);
    }
}

/* Large screen optimizations */
@media (min-width: 1920px) {
    .max-w-7xl {
        max-width: 1400px;
    }
}
