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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* Container and Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

.header h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Form Sections */
.project-form {
    background: white;
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    margin-bottom: 2rem;
}

.form-section {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #f5f7fa;
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.form-section h2 {
    font-size: 1.8rem;
    color: #2d3748;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.section-description {
    color: #718096;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

/* Form Labels and Inputs */
.form-group label {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 0.875rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

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

.form-group input:invalid {
    border-color: #fc8181;
}

.form-group small {
    color: #718096;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Features Container */
.features-container {
    margin-top: 1.5rem;
}

.loading-features {
    text-align: center;
    color: #718096;
    padding: 2rem;
    font-style: italic;
}

.feature-category {
    margin-bottom: 2rem;
}

.feature-category h3 {
    font-size: 1.2rem;
    color: #4a5568;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.feature-item {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.feature-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.feature-item.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea10, #764ba210);
}

.feature-item.conflict {
    border-color: #fc8181;
    background: #fed7d7;
}

.feature-item.missing-dependency {
    border-color: #f6ad55;
    background: #fefcbf;
}

.feature-checkbox {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.feature-name {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.5rem;
    padding-right: 2rem;
}

.feature-description {
    color: #4a5568;
    font-size: 0.9rem;
    line-height: 1.5;
}

.feature-dependencies {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: #718096;
}

/* Environment Tabs */
.environment-tabs {
    display: flex;
    margin-bottom: 2rem;
    background: #f7fafc;
    border-radius: 12px;
    padding: 0.5rem;
}

.tab-button {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: #4a5568;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-button:hover {
    background: rgba(102, 126, 234, 0.1);
}

.tab-button.active {
    background: #667eea;
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Environment Config */
.environment-config {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.environment-config.active {
    display: block;
}

.environment-config h3 {
    font-size: 1.3rem;
    color: #2d3748;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.feature-fields {
    transition: all 0.3s ease;
}

/* Admin User Section */
.section-toggle {
    margin-bottom: 1.5rem;
}

.toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: #4a5568;
}

.toggle-checkbox {
    margin-right: 0.75rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.admin-user-section {
    animation: slideDown 0.3s ease-out;
}

/* Generation Controls */
.generation-controls {
    text-align: center;
    margin-bottom: 2rem;
}

.generate-button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.3);
}

.generate-button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.4);
}

.generate-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
    display: inline-block;
}

/* Messages */
.error-message,
.success-message,
.validation-message {
    padding: 1rem;
    border-radius: 10px;
    margin: 1rem 0;
    font-weight: 500;
}

.error-message {
    background: #fed7d7;
    color: #c53030;
    border: 1px solid #fc8181;
}

.success-message {
    background: #c6f6d5;
    color: #22543d;
    border: 1px solid #68d391;
}

.validation-message {
    background: #fefcbf;
    color: #744210;
    border: 1px solid #f6ad55;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header h1 {
        font-size: 2.5rem;
    }

    .project-form {
        padding: 1.5rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .environment-tabs {
        flex-direction: column;
        gap: 0.5rem;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }

    .generate-button {
        width: 100%;
        padding: 1.2rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 2rem;
    }

    .project-form {
        padding: 1rem;
    }

    .form-section h2 {
        font-size: 1.5rem;
    }
}

/* Focus Accessibility */
.feature-item:focus,
.tab-button:focus,
.generate-button:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .feature-item {
        border-width: 3px;
    }

    .form-group input:focus,
    .form-group textarea:focus {
        border-width: 3px;
    }
}

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

/* Environment Tab Labels */
.tab-button .required {
    color: #e53e3e;
    font-weight: 600;
    font-size: 0.85em;
    margin-left: 4px;
}

.tab-button .optional {
    color: #718096;
    font-weight: 400;
    font-size: 0.75em;
    margin-left: 4px;
    font-style: italic;
}

.tab-button:hover .optional {
    color: #4a5568;
}

.tab-button.active .optional {
    color: #a0aec0;
}

.tab-button.active .required {
    color: #feb2b2;
}

/* Print Styles */
@media print {
    .generate-button,
    .loading-spinner {
        display: none;
    }

    .container {
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    .project-form {
        box-shadow: none;
        border: 1px solid #000;
    }
}