/* Critical paths CSS to prevent FOUC and jitter */
:root {
    color-scheme: light;
}

/* Base styles */
html {
    background-color: #f8fafc;
    min-height: 100vh;
}

body {
    opacity: 0;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: #1e293b;
    font-family: system-ui, -apple-system, sans-serif;
    margin: 0;
    min-height: 100vh;
}

body.ready {
    opacity: 1;
    transition: opacity 0.2s ease;
}

/* Critical form styles */
.form-group input {
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    color: #1e293b;
    width: 100%;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
}

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

/* Mobile optimization */
@media (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
    
    /* Prevent button/element breaking */
    button, a, .btn {
        white-space: nowrap;
        min-width: fit-content;
    }
    
    /* Responsive text sizes */
    h1 { font-size: 1.75rem !important; }
    h2 { font-size: 1.5rem !important; }
    h3 { font-size: 1.25rem !important; }
    
    /* Responsive spacing */
    .container, .max-w-7xl, .max-w-6xl {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Responsive buttons */
    .rounded-full {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Stack flex items on mobile */
    .flex-row {
        flex-direction: column;
    }
    
    /* Responsive gap */
    .gap-4, .gap-6 {
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    h1 { font-size: 1.5rem !important; }
    h2 { font-size: 1.25rem !important; }
    h3 { font-size: 1.125rem !important; }
    
    /* Even smaller padding on very small screens */
    .container, .max-w-7xl, .max-w-6xl {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    /* Smaller buttons on mobile */
    .px-8 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .py-4 {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }
    
    .text-lg {
        font-size: 0.9375rem !important;
    }
}

/* Prevent unwanted mobile behaviors */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Loading state */
.content-loading {
    opacity: 0;
}

.content-visible {
    opacity: 1;
    transition: opacity 0.3s ease-out;
}

/* Spinner styles */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-dark {
    border: 2px solid rgba(59, 130, 246, 0.2);
    border-top-color: #3b82f6;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

.spinner-xl {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

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

/* Animate spin utility class */
.animate-spin {
    animation: spin 1s linear infinite;
}

/* Button loading state */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

.btn-loading .btn-text {
    visibility: hidden;
}

.btn-loading .spinner {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* Full page loading overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(59, 130, 246, 0.2);
    border-top-color: #3b82f6;
}

.loading-overlay p {
    margin-top: 1rem;
    color: #64748b;
    font-size: 0.875rem;
}

/* Theme colors */
.bg-card { background-color: #fff; }
.bg-input { background-color: #fff; }
.text-gradient {
    background: linear-gradient(to right, #22d3ee, #3b82f6, #8b5cf6);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}
.gradient-bg {
    background: linear-gradient(135deg, #22d3ee 0%, #3b82f6 50%, #8b5cf6 100%);
}
.glass-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}
