/* EVALOOP Main Stylesheet */

/* CSS Variables */
:root {
    --primary-color: #2563eb;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --success-color: #22c55e;
    --warning-color: #eab308;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    
    --background: #ffffff;
    --background-alt: #f9fafb;
    --background-dark: #111827;
    
    --border-color: #e5e7eb;
    --border-radius: 8px;
    
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-code: 'JetBrains Mono', 'Courier New', monospace;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    color: var(--text-primary);
    background-color: var(--background);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.display-4 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.lead {
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.5;
}

code {
    font-family: var(--font-code);
    background-color: var(--background-alt);
    padding: 0.125rem 0.25rem;
    border-radius: 4px;
    font-size: 0.875em;
}

/* Navigation */
.navbar {
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.nav-link {
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    padding: 0.5rem 1rem;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.nav-link.btn {
    border-radius: 6px;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--background-alt) 0%, var(--background) 100%);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(37, 99, 235, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.min-vh-50 {
    min-height: 50vh;
}

/* Stats Container */
.stats-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.stat-card {
    background: var(--background-alt);
    border-radius: var(--border-radius);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.counter {
    font-variant-numeric: tabular-nums;
}

/* Feature Cards */
.feature-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.feature-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background-alt);
    border-radius: 50%;
}

/* Buttons */
.btn {
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-outline-secondary:hover {
    background-color: var(--background-alt);
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* Tables */
.table {
    font-size: 0.95rem;
}

.table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.025em;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

.table-hover tbody tr:hover {
    background-color: var(--background-alt);
    cursor: pointer;
}

.table-fixed {
    table-layout: fixed;
    width: 100%;
}

.table-fixed th:nth-child(1),
.table-fixed td:nth-child(1) {
    width: 20%;
}

.table-fixed th:nth-child(2),
.table-fixed td:nth-child(2) {
    width: 30%;
}

.table-fixed th:nth-child(3),
.table-fixed td:nth-child(3) {
    width: 25%;
}

.table-fixed th:nth-child(4),
.table-fixed td:nth-child(4) {
    width: 25%;
}

.table-fixed td {
    word-wrap: break-word;
    vertical-align: top;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.rank-badge {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

.rank-1 { background: linear-gradient(135deg, #ffd700, #ffed4e); color: #8b6914; }
.rank-2 { background: linear-gradient(135deg, #c0c0c0, #e8e8e8); color: #5a5a5a; }
.rank-3 { background: linear-gradient(135deg, #cd7f32, #e6a157); color: #704214; }

/* Cards */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.card-footer {
    border-top: 1px solid var(--border-color);
    background-color: var(--background-alt);
}

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

footer a {
    text-decoration: none;
    transition: opacity 0.2s ease;
}

footer a:hover {
    opacity: 0.8;
}

/* Utility Classes */
.text-primary { color: var(--primary-color) !important; }
.text-secondary { color: var(--secondary-color) !important; }
.text-accent { color: var(--accent-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-info { color: var(--info-color) !important; }
.text-muted { color: var(--text-muted) !important; }

.bg-gradient {
    background: linear-gradient(135deg, var(--background-alt) 0%, var(--background) 100%);
}

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

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

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

.slide-up {
    animation: slideUp 0.8s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    .display-4 {
        font-size: 2rem;
    }
    
    .lead {
        font-size: 1.125rem;
    }
    
    .hero-section {
        padding: 3rem 0;
    }
    
    .stats-container {
        margin-top: 2rem;
    }
    
    .btn-lg {
        font-size: 1rem;
        padding: 0.625rem 1.25rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    footer .text-md-end {
        text-align: left !important;
        margin-top: 2rem;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .display-6 {
        font-size: 1.75rem;
    }
    
    .stat-card {
        padding: 1rem !important;
    }
    
    .d-flex.gap-3 {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Loading Spinner */
.spinner-border {
    width: 1.5rem;
    height: 1.5rem;
    border-width: 0.2rem;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus Styles */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* EVALOOP Example Styles */
.evaloop-example {
    background: var(--background-alt);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.evaloop-example h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.loop-sequence {
    margin: 1.5rem 0;
}

.loop-item {
    background: white;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.2s ease;
}

.loop-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.loop-item.success {
    border-left: 4px solid var(--success-color);
}

.loop-item.failure {
    border-left: 4px solid var(--danger-color);
}

.loop-item.skipped {
    border-left: 4px solid var(--text-muted);
    opacity: 0.8;
}

.loop-header {
    background: var(--background-alt);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.loop-number {
    font-weight: 600;
    color: var(--text-primary);
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

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

.status-badge.fail {
    background: var(--danger-color);
    color: white;
}

.status-badge.skipped {
    background: var(--text-muted);
    color: white;
}

.loop-content {
    padding: 1rem;
}

.loop-content p {
    margin-bottom: 0.5rem;
}

.loop-content p:last-child {
    margin-bottom: 0;
}

.loop-content strong {
    color: var(--text-primary);
}

.loop-content code {
    background: var(--background-alt);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: var(--font-code);
    font-size: 0.875rem;
    word-break: break-all;
}

.loop-content pre {
    background: #000000;
    color: #ffffff;
    padding: 1rem;
    border-radius: 6px;
    margin: 0.5rem 0;
    overflow-x: auto;
}

.loop-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: 0.875rem;
    word-break: normal;
    white-space: pre;
}

.calculation-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border-color);
}

.calculation-section h5 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.calculation-steps {
    background: white;
    border-radius: var(--border-radius);
    padding: 1rem;
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.calc-step {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--background-alt);
}

.calc-step:last-child {
    border-bottom: none;
}

.calc-label {
    font-weight: 600;
    color: var(--text-primary);
    flex-shrink: 0;
    margin-right: 1rem;
}

.calc-value {
    text-align: right;
    color: var(--text-secondary);
    font-family: var(--font-code);
    font-size: 0.9rem;
}

.final-formula {
    background: var(--primary-color);
    color: white;
    border-radius: var(--border-radius);
    padding: 1rem;
    text-align: center;
}

.final-formula h6 {
    margin-bottom: 0.5rem;
    color: white;
}

.final-formula p {
    margin-bottom: 0.25rem;
    font-family: var(--font-code);
}

.final-formula p:last-child {
    margin-bottom: 0;
    opacity: 0.8;
    font-size: 0.875rem;
}

/* Responsive adjustments for EVALOOP example */
@media (max-width: 768px) {
    .evaloop-example {
        padding: 1rem;
    }
    
    .loop-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .calc-step {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .calc-value {
        text-align: left;
    }
    
    .loop-content code {
        word-break: break-word;
        white-space: pre-wrap;
    }
}

/* Team Member Styles */
.member-affiliation {
    margin-bottom: 0.1rem !important;
    font-size: 1.1rem !important;
}

.member-affiliation:last-of-type {
    margin-bottom: 1rem !important;
}

.member-name {
    font-size: 1.5rem !important;
}

.member-role {
    font-size: 1.1rem !important;
}

.member-links {
    margin-top: 1rem;
}

.member-links a {
    font-size: 1.5rem !important;
    margin-right: 1rem;
    color: var(--primary-color);
    transition: color 0.2s ease;
}

.member-links a:hover {
    color: var(--secondary-color);
}

.member-links i {
    font-size: 1.5rem !important;
}

/* Print Styles */
@media print {
    .navbar,
    footer,
    .btn,
    .no-print {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
}
