/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    line-height: 1.6;
    color: #2d3748;
    position: relative;
    overflow-x: hidden;
}

/* Background Pattern */
.background-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(255,255,255,0.05) 0%, transparent 50%);
    z-index: -1;
}

/* Main Container */
.main-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Header Section */
.header-section {
    text-align: center;
    margin-bottom: 30px;
}

.logo-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.logo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo-placeholder i {
    font-size: 2.5rem;
    color: #667eea;
    animation: pulse 2s infinite;
}

.logo-text {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-subtitle {
    color: #64748b;
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.8;
}

/* Form Container */
.form-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
    position: relative;
}

.form-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 40px 40px 30px;
    text-align: center;
    position: relative;
}

.form-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
    background-size: 400% 400%;
    animation: gradient 3s ease infinite;
}

.form-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.form-title i {
    font-size: 1.8rem;
}

.form-description {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 400;
}

/* Form Sections */
form {
    padding: 40px;
}

.section-card {
    background: #f8fafc;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.section-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.section-header i {
    font-size: 1.3rem;
    color: #667eea;
}

.section-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2d3748;
}

/* Form Layout */
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    flex: 1;
    position: relative;
}

.form-group.half-width {
    flex: 0 0 calc(50% - 10px);
}

/* Labels */
label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

label i {
    color: #667eea;
    font-size: 0.9rem;
}

.required {
    color: #ef4444;
    font-weight: 700;
}

/* Input Styles */
input, select, textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

input:valid:not(:placeholder-shown) {
    border-color: #10b981;
}

input:invalid:not(:placeholder-shown) {
    border-color: #ef4444;
}

/* Select Styles */
select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
    appearance: none;
}

/* Textarea Styles */
textarea {
    resize: vertical;
    min-height: 80px;
}

/* Input with Unit */
.input-with-unit {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-unit input {
    padding-right: 60px;
}

.unit {
    position: absolute;
    right: 16px;
    color: #64748b;
    font-weight: 500;
    font-size: 0.9rem;
    pointer-events: none;
}

/* Field Notes */
.field-note {
    display: block;
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 6px;
    font-style: italic;
}

/* Genetic Information Notice */
.genetic-info-notice {
    background: #f0f9ff;
    border: 1px solid #0ea5e9;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    color: #0c4a6e;
    font-size: 0.9rem;
    line-height: 1.5;
}

.genetic-info-notice strong {
    color: #0369a1;
}

/* Error Messages */
.error-message {
    display: none;
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 6px;
    font-weight: 500;
    padding: 8px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    animation: shake 0.5s ease-in-out;
}

.error-message.show {
    display: block;
}

/* Submit Section */
.submit-section {
    text-align: center;
    margin-top: 40px;
}

.submit-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 18px 40px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 250px;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn.loading {
    pointer-events: none;
}

.submit-btn.loading .btn-text {
    opacity: 1; /* keep text visible while loading */
}

/* Ensure spinner icon and text sit side by side nicely */
.submit-btn .fa-spinner {
    margin-right: 8px;
}

/* Keep legacy spinner hidden by default; inline FA spinner is used while loading */
.loading-spinner { display: none; }

.submit-btn .btn-text { color: #fff; position: relative; z-index: 1; }

.submit-btn.loading .loading-spinner {
    display: block;
}

/* Form Footer */
.form-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.disclaimer {
    color: #64748b;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 600px;
    margin: 0 auto;
}

.disclaimer i {
    color: #3b82f6;
}

/* Success Message */
.success-message {
    display: none;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 40px;
    text-align: center;
    animation: slideIn 0.5s ease-out;
}

.success-message.show {
    display: block;
}

.success-content i {
    font-size: 3rem;
    margin-bottom: 20px;
    display: block;
}

.success-content h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

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

@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .main-container {
        padding: 15px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .form-group.half-width {
        flex: 1;
    }
    
    .form-container,
    .section-card {
        padding: 25px 20px;
    }
    
    .form-header {
        padding: 30px 20px 25px;
    }
    
    .form-title {
        font-size: 1.6rem;
    }
    
    .logo-text {
        font-size: 1.8rem;
    }
    
    .submit-btn {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .form-title {
        flex-direction: column;
        gap: 10px;
    }
    
    .logo-placeholder {
        flex-direction: column;
        gap: 10px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* Print Styles */
@media print {
    .background-pattern,
    .submit-btn {
        display: none !important;
    }
    
    body {
        background: white !important;
    }
    
    .form-container,
    .section-card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .form-container {
        border: 3px solid #000;
    }
    
    input:focus, select:focus, textarea:focus {
        border-color: #000;
        box-shadow: 0 0 0 3px #000;
    }
}

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

/* Progress Bar Styles */
.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    margin-top: 20px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #4ecdc4);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

.tooltip-icon {
    margin-left: 5px;
    cursor: help;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.tooltip-icon:hover {
    opacity: 1;
}

input.has-value, select.has-value, textarea.has-value {
    border-color: #10b981;
}

input.error, select.error, textarea.error {
    border-color: #ef4444 !important;
    animation: shake 0.5s ease-in-out;
}

body.loaded {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}