:root {
    --primary-color: #1a365d;
    --primary-light: #2d5aa0;
    --accent-color: #38b2ac;
    --accent-light: #4fd1c7;
    --secondary-color: #6c757d;
    --success-color: #38a169;
    --warning-color: #d69e2e;
    --danger-color: #e53e3e;
    --info-color: #3182ce;
    --light-color: #f7fafc;
    --dark-color: #1a202c;
    --gradient-primary: linear-gradient(135deg, #1a365d 0%, #2d5aa0 100%);
    --gradient-accent: linear-gradient(135deg, #38b2ac 0%, #4fd1c7 100%);
}

body {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    min-height: 100vh;
}

.navbar {
    background: var(--gradient-primary) !important;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(26, 54, 93, 0.1);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.4rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.brand-text {
    background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 6px;
    margin: 0 2px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

/* Show only home section by default */
.content-section {
    display: none;
}

#home-section {
    display: block;
}

/* Ensure JavaScript can override section visibility */
.content-section[style*="display: block"] {
    display: block !important;
}

/* JavaScript will directly set inline styles */

/* Ensure proper sidebar layout without overflow */
@media (min-width: 768px) {
    .col-lg-3, .col-md-4 {
        position: sticky;
        top: 20px;
        height: fit-content;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
    }
}

/* Responsive layout - prevent horizontal overflow */
.container-fluid {
    max-width: 100vw;
    overflow-x: hidden;
}

/* Ensure content sections stack in the same location */
.content-section {
    width: 100%;
    position: relative;
}

/* Clean grid spacing */
.row.g-3 {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 1rem;
}

@media (max-width: 767px) {
    .container-fluid .row {
        flex-wrap: wrap;
    }
    
    .col-lg-3, .col-md-4,
    .col-lg-9, .col-md-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .col-lg-3, .col-md-4 {
        margin-bottom: 20px;
    }
}

/* Clean card layouts */
.card {
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.card {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    transition: all 0.3s ease;
}

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

.card-header {
    background: var(--gradient-primary);
    color: white;
    border-bottom: none;
    font-weight: 600;
    border-radius: 12px 12px 0 0;
}

/* Hero Section Styles */
.hero-section {
    padding: 3rem 2rem;
    background: var(--gradient-primary);
    border-radius: 16px;
    color: white;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.hero-section > * {
    position: relative;
    z-index: 1;
}

.feature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-top: 2rem;
    padding: 0 1rem;
}

@media (max-width: 768px) {
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0;
    }
}

.feature-item {
    text-align: center;
    padding: 1.25rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.feature-item:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.15);
}

.feature-item i {
    font-size: 2rem;
    margin-bottom: 0.8rem;
    display: block;
}

.feature-item h5 {
    color: white;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.feature-item p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.4;
}

/* Workflow Steps */
.workflow-steps {
    margin-top: 1rem;
}

.workflow-step {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: 8px;
    background: rgba(56, 178, 172, 0.05);
    border-left: 3px solid var(--accent-color);
}

.step-number {
    background: var(--gradient-accent);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 1rem;
    flex-shrink: 0;
}

.step-content h6 {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.step-content p {
    color: var(--secondary-color);
    margin: 0;
    font-size: 0.9rem;
}

/* Feature List */
.feature-list {
    list-style: none;
    padding: 0;
}

.feature-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 0.9rem;
}

.feature-list li:last-child {
    border-bottom: none;
}

/* Disclaimer Lists */
.disclaimer-list {
    list-style: none;
    padding: 0;
    margin-bottom: 1rem;
}

.disclaimer-list li {
    padding: 0.4rem 0;
    font-size: 0.9rem;
    color: var(--secondary-color);
    display: flex;
    align-items: flex-start;
}

.disclaimer-list li:before {
    content: "•";
    color: var(--accent-color);
    font-weight: bold;
    width: 1em;
    margin-right: 0.5rem;
    margin-top: 0.1rem;
    flex-shrink: 0;
}

/* Enhanced warning card styling */
.card.border-warning {
    border-width: 2px !important;
}

.card.border-warning .card-header {
    background: linear-gradient(135deg, #f6ad55 0%, #ed8936 100%) !important;
    color: white !important;
    font-weight: 600;
}

.card.border-warning .card-header h5 {
    color: white !important;
}

/* Legal Document Styles */
.legal-document {
    font-size: 0.95rem;
    line-height: 1.6;
}

.document-header {
    text-align: center;
}

.document-meta p {
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
}

.legal-section {
    margin-bottom: 2rem;
}

.section-divider {
    margin: 2rem 0;
    border-color: #e9ecef;
}

.legal-section h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-light);
}

.legal-section h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.permitted-list li {
    margin-bottom: 0.5rem;
    color: var(--success-color);
}

.prohibited-list li {
    margin-bottom: 0.5rem;
    color: var(--danger-color);
}

.permitted-list li::marker,
.prohibited-list li::marker {
    color: inherit;
}

.agreement-footer {
    margin-top: 2rem;
}

/* Footer Styles */
footer {
    margin-top: auto;
}

footer a {
    color: #adb5bd !important;
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #ffffff !important;
    text-decoration: underline;
}

/* Ensure main content takes full height */
.main-content {
    min-height: calc(100vh - 200px);
}

.table-responsive {
    border-radius: 0.375rem;
    overflow: hidden;
}

.table th {
    background: var(--gradient-primary);
    color: white;
    border: none;
    font-weight: 600;
    font-size: 0.875rem;
}

/* Button Enhancements */
.btn-primary {
    background: var(--gradient-primary);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(26, 54, 93, 0.3);
}

.btn-outline-primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-outline-primary:hover {
    background: var(--gradient-primary);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
}

/* Enhanced animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Removed conflicting .content-section rule - using the one at line 54 instead */

.table td {
    border-color: #dee2e6;
    vertical-align: middle;
}

.technique-card {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.technique-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

.technique-card.selected {
    border-color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.05);
}

.score-bar {
    height: 8px;
    border-radius: 4px;
    background-color: #e9ecef;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.score-excellent { background-color: var(--success-color); }
.score-good { background-color: var(--info-color); }
.score-fair { background-color: var(--warning-color); }
.score-poor { background-color: var(--danger-color); }

.property-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.property-item {
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.75rem;
}

.property-label {
    font-size: 0.875rem;
    color: var(--secondary-color);
    margin-bottom: 0.25rem;
}

.property-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-color);
}

.factor-item {
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.factor-name {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.factor-range {
    font-size: 1.1rem;
    color: var(--dark-color);
    margin-bottom: 0.25rem;
}

.factor-notes {
    font-size: 0.875rem;
    color: var(--secondary-color);
}

.experiment-item {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background-color: white;
}

.experiment-id {
    font-weight: 600;
    color: var(--primary-color);
}

.experiment-status {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.status-pending {
    background-color: var(--warning-color);
    color: white;
}

.status-complete {
    background-color: var(--success-color);
    color: white;
}

.model-performance {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.model-card {
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
}

.model-name {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.metric-label {
    color: var(--secondary-color);
    font-size: 0.875rem;
}

.metric-value {
    font-weight: 600;
}

.optimization-card {
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.optimization-rank {
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
}

.protocol-step {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    overflow: hidden;
}

.protocol-step-header {
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1rem;
    font-weight: 600;
}

.protocol-step-body {
    padding: 1rem;
}

.step-description {
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.step-parameters {
    background-color: var(--light-color);
    border-radius: 0.25rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.safety-notes {
    border-left: 4px solid var(--warning-color);
    background-color: rgba(255, 193, 7, 0.1);
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.critical-points {
    border-left: 4px solid var(--danger-color);
    background-color: rgba(220, 53, 69, 0.1);
    padding: 0.75rem;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
}

.btn-group-sm .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

.text-muted {
    color: var(--secondary-color) !important;
}

.alert {
    border: none;
    border-radius: 0.375rem;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .property-grid {
        grid-template-columns: 1fr;
    }
    
    .model-performance {
        grid-template-columns: 1fr;
    }
    
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    .card-header,
    .sidebar {
        display: none !important;
    }
    
    .card {
        border: none !important;
        box-shadow: none !important;
    }
    
    .protocol-step {
        break-inside: avoid;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

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

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

/* Focus styles */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Error states */
.is-invalid {
    border-color: var(--danger-color);
}

.is-invalid:focus {
    border-color: var(--danger-color);
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Success states */
.is-valid {
    border-color: var(--success-color);
}

.is-valid:focus {
    border-color: var(--success-color);
    box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.25);
}
