body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

/* Smooth scrolling for modal content */
html {
    scroll-behavior: smooth;
}

.container {
    animation: fadeIn 0.3s ease-out;
}

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

select, input, textarea {
    transition: all 0.2s ease;
}

select:focus, input:focus, textarea:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

button:hover {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

#loadingIndicator {
    animation: pulse 2s infinite;
}

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

.fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

#errorMessage, #successMessage {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

pre {
    max-height: 300px;
    overflow-y: auto;
}

pre::-webkit-scrollbar {
    width: 6px;
}

pre::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

pre::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

pre::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Custom Radio Button Styling */
input[type="radio"]:checked + div {
    border-color: #3b82f6 !important;
    background-color: #3b82f6 !important;
}

input[type="radio"]:checked + div > div {
    opacity: 1 !important;
}

/* Research Mode Toggle Animations */
#researchModeToggle:checked + div {
    background-color: #3b82f6;
}

#researchModeToggle:checked + div:after {
    transform: translateX(100%);
    border-color: white;
}

/* Form Section Transitions */
#branchSection, #actionTypeSection {
    transition: all 0.3s ease-in-out;
}

/* Action Type Cards Hover Effects */
.action-type-card:hover {
    background-color: #4b5563 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Enhanced Focus States */
input[type="radio"]:focus + div {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#researchModeToggle:focus + div {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Research Mode Active State */
.research-mode-active {
    border-color: #10b981 !important;
    background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
}

.research-mode-active i {
    color: #10b981 !important;
}

/* Loading State Enhancements */
.processing-research .fa-spinner {
    color: #10b981;
}

/* Button Icon Transitions */
button i {
    transition: transform 0.2s ease;
}

button:hover i {
    transform: scale(1.1);
}

/* Custom Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #4b5563;
    transition: 0.3s;
    border-radius: 12px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #3b82f6;
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Research Interface Styles */
.research-card {
    transition: all 0.3s ease;
    border: 1px solid #374151;
}

.research-card:hover {
    border-color: #4b5563;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.research-preview {
    max-height: 4rem;
    overflow: hidden;
    position: relative;
}

.research-preview::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1rem;
    background: linear-gradient(transparent, #1f2937);
}

/* Pagination Styles */
.pagination-btn {
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background-color: #3b82f6;
    transform: translateY(-1px);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-current {
    background-color: #3b82f6;
    color: white;
}

/* Tab Styles */
.tab-active {
    background-color: #3b82f6 !important;
    color: white !important;
}

.tab-inactive {
    background-color: transparent !important;
    color: #9ca3af !important;
}

/* Markdown Content Styles */
.prose {
    color: #e5e7eb;
}

.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
    color: #f9fafb;
    font-weight: 600;
}

.prose h1 {
    font-size: 1.875rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #374151;
    padding-bottom: 0.5rem;
}

.prose h2 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #374151;
    padding-bottom: 0.25rem;
}

.prose h3 {
    font-size: 1.25rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.prose p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.prose code {
    background-color: #374151;
    color: #f87171;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.prose pre {
    background-color: #1f2937;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.prose pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
}

.prose ul, .prose ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.prose li {
    margin-bottom: 0.5rem;
}

.prose blockquote {
    border-left: 4px solid #3b82f6;
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
    color: #d1d5db;
    background-color: #374151;
    padding: 1rem;
    border-radius: 0.25rem;
}

.prose a {
    color: #60a5fa;
    text-decoration: underline;
}

.prose a:hover {
    color: #93c5fd;
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.prose th, .prose td {
    border: 1px solid #374151;
    padding: 0.75rem;
    text-align: left;
}

.prose th {
    background-color: #374151;
    font-weight: 600;
}

.prose strong {
    color: #f9fafb;
    font-weight: 600;
}

.prose em {
    font-style: italic;
}

/* Copy Success Animation */
.copy-success {
    animation: copyPulse 0.3s ease;
}

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

/* Research Table Styles */
.research-table-row {
    border-bottom: 1px solid #374151;
    transition: background-color 0.2s ease;
}

.research-table-row:hover {
    background-color: #374151;
}

/* About Page Styles */
#aboutSection .grid {
    transition: all 0.3s ease;
}

#aboutSection .bg-gray-700:hover {
    background-color: #4b5563;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Mobile Navigation Tabs */
@media (max-width: 768px) {
    .bg-gray-800.p-1.rounded-lg.flex.flex-nowrap.gap-1 {
        padding: 0.5rem;
        gap: 0.125rem;
        justify-content: center;
    }
    
    .bg-gray-800.p-1.rounded-lg.flex.flex-nowrap.gap-1 button {
        font-size: 0.75rem;
        padding: 0.5rem 0.5rem;
        flex: 1;
        white-space: nowrap;
        min-width: 0;
    }
    
    .bg-gray-800.p-1.rounded-lg.flex.flex-nowrap.gap-1 button i {
        font-size: 0.75rem;
        margin-right: 0.25rem;
    }
}

/* Extra small mobile screens */
@media (max-width: 480px) {
    .bg-gray-800.p-1.rounded-lg.flex.flex-nowrap.gap-1 button {
        font-size: 0.7rem;
        padding: 0.4rem 0.3rem;
    }
    
    .bg-gray-800.p-1.rounded-lg.flex.flex-nowrap.gap-1 button i {
        font-size: 0.7rem;
        margin-right: 0.2rem;
    }
}

/* Mobile Responsiveness for Action Type Cards */
@media (max-width: 640px) {
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .action-type-card {
        margin-bottom: 0.75rem;
    }
    
    .research-card {
        margin-bottom: 1rem;
    }
    
    .prose {
        font-size: 0.875rem;
    }
    
    .prose h1 {
        font-size: 1.5rem;
    }
    
    .prose h2 {
        font-size: 1.25rem;
    }
    
    .prose pre {
        font-size: 0.75rem;
        padding: 0.75rem;
    }
    
    /* About page mobile optimizations */
    #aboutSection h1 {
        font-size: 1.75rem;
    }
    
    #aboutSection h2 {
        font-size: 1.25rem;
    }
    
    #aboutSection .md\:grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    #aboutSection .lg\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    #aboutSection .sm\:grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    #aboutSection .p-8 {
        padding: 1.5rem;
    }
    
    #aboutSection .text-4xl {
        font-size: 2rem;
    }
    
    #aboutSection .text-xl {
        font-size: 1rem;
    }
}

/* Step Flow Styles */
.flow-steps {
    animation: fadeIn 0.2s ease-out;
}

.step-card {
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
    border: 1px solid #4b5563;
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    overflow: hidden;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.step-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border-color: #6b7280;
}

.step-number {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    font-weight: 700;
    color: white;
    margin: 0 auto 1rem auto;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.step-icon {
    font-size: 1.5rem;
    color: #60a5fa;
    margin-bottom: 0.75rem;
}

.step-title {
    font-size: 1rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0.5rem;
}

.step-desc {
    font-size: 0.875rem;
    color: #d1d5db;
    line-height: 1.5;
}

/* Flow selector button styles */
#automationFlowBtn, #researchFlowBtn {
    transition: all 0.2s ease;
}

#automationFlowBtn:hover, #researchFlowBtn:hover {
    background-color: #4b5563 !important;
    transform: translateY(-1px);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .step-card {
        padding: 1.25rem;
    }
    
    .step-number {
        width: 2rem;
        height: 2rem;
        font-size: 1rem;
    }
    
    .step-icon {
        font-size: 1.25rem;
    }
    
    .step-title {
        font-size: 0.875rem;
    }
    
    .step-desc {
        font-size: 0.8rem;
    }
    
    /* Flow selector buttons mobile */
    #automationFlowBtn, #researchFlowBtn {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
    
    #automationFlowBtn i, #researchFlowBtn i {
        font-size: 0.7rem;
    }
}

@media (max-width: 640px) {
    .step-card {
        padding: 1rem;
    }
    
    .step-number {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.875rem;
        margin-bottom: 0.75rem;
    }
    
    .step-icon {
        font-size: 1.125rem;
        margin-bottom: 0.5rem;
    }
    
    .step-title {
        font-size: 0.8rem;
        margin-bottom: 0.375rem;
    }
    
    .step-desc {
        font-size: 0.75rem;
    }
}

/* Step animation sequence - immediate display for about page */
.step-card:nth-child(1) { animation-delay: 0s; }
.step-card:nth-child(2) { animation-delay: 0s; }
.step-card:nth-child(3) { animation-delay: 0s; }
.step-card:nth-child(4) { animation-delay: 0s; }
.step-card:nth-child(5) { animation-delay: 0s; }
.step-card:nth-child(6) { animation-delay: 0s; }

/* About section optimization for faster initial load */
.about-section-loading {
    display: none;
}

/* Show about section immediately if hash is #about */
:root:has([href*="#about"]) .about-section-loading,
body:has(.container[data-hash="about"]) .about-section-loading {
    display: block;
}

/* Alternative approach using URL hash detection */
.about-section-loading:target {
    display: block;
}

/* Instant display for about page step cards */
#aboutSection .step-card {
    opacity: 1;
    transform: translateY(0);
}

/* Remove animation delays for immediate about page rendering */
#aboutSection .step-card[style*="animation"] {
    animation: none !important;
}

/* Performance optimization: reduce paint complexity */
* {
    box-sizing: border-box;
}

.step-card, .research-card, .action-type-card {
    contain: layout style;
}