:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #7c3aed;
    --accent-color: #06b6d4;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-color);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 3rem 0;
    box-shadow: var(--shadow-md);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

header .subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-bottom: 0.25rem;
}

header .authors {
    font-size: 0.95rem;
    opacity: 0.85;
    font-style: italic;
}

/* Navigation */
.main-nav {
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.main-nav .container {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 2rem;
    overflow-x: auto;
}

.nav-btn {
    background: transparent;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 0.5rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-btn:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.nav-btn.active {
    background: var(--primary-color);
    color: white;
}

/* Main Content */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 400px);
}

.section {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.section.active {
    display: block;
}

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

/* Cards */
.hero-card, .content-card, .feature-card {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.hero-card h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.hero-card p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

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

.stat-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.95rem;
    opacity: 0.9;
}

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

.feature-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.feature-card p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Buttons */
.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

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

/* Controls Panel */
.controls-panel {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    align-items: end;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-color);
}

.control-group select,
.control-group input[type="range"],
.control-group input[type="number"] {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.control-group select:focus,
.control-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.control-group input[type="range"] {
    padding: 0;
    height: 2.5rem;
}

.control-group input[type="number"] {
    width: 100%;
}

.control-group input[type="number"]::-webkit-inner-spin-button,
.control-group input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
}

/* Chart Container */
.chart-container {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    min-height: 400px;
}

/* Table */
.table-container {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.table-container h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.table-scroll {
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    position: sticky;
    top: 0;
    background: var(--primary-color);
    color: white;
    z-index: 10;
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

tbody tr:hover {
    background: var(--bg-color);
}

.info-table {
    margin-top: 1rem;
}

.info-table thead {
    background: var(--bg-color);
    color: var(--text-color);
}

.info-table th {
    border-bottom: 2px solid var(--border-color);
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 1rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-spinner p {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Info Panel */
.info-panel {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 1rem;
    padding: 2rem;
    margin-top: 2rem;
    border: 1px solid #bae6fd;
}

.info-panel h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.info-panel p {
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.note {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Content Cards */
.content-card h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.content-card h4 {
    color: var(--text-color);
    font-size: 1.2rem;
    margin: 1.5rem 0 0.75rem;
}

.content-card ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.content-card li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.content-card blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1.5rem;
    margin: 1rem 0;
    font-style: italic;
    color: var(--text-secondary);
}

.content-card a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.content-card a:hover {
    text-decoration: underline;
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 1rem;
}

.contact-grid h4 {
    margin-top: 0;
}

/* Footer */
footer {
    background: var(--text-color);
    color: white;
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
}

footer p {
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    header .subtitle {
        font-size: 1rem;
    }

    .container {
        padding: 0 1rem;
    }

    .controls-panel {
        grid-template-columns: 1fr;
    }

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

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

    .chart-container {
        padding: 1rem;
    }

    th, td {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
}

/* Print Styles */
@media print {
    .main-nav, footer {
        display: none;
    }

    .section {
        display: block !important;
        page-break-inside: avoid;
    }
}

/* Nuclear Chart Styles */
.nuclear-chart-container {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    min-height: 650px;
    position: relative;
}

#nuclearChartCanvas {
    width: 100% !important;
    height: 600px !important;
    cursor: crosshair;
}

.chart-legend {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.chart-legend h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

#legend-content {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    width: 30px;
    height: 20px;
    border-radius: 0.25rem;
    border: 1px solid var(--border-color);
}

.legend-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Nucleus Tooltip */
.nucleus-tooltip {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card-bg);
    border-radius: 1rem;
    box-shadow: var(--shadow-xl);
    border: 2px solid var(--primary-color);
    z-index: 1000;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.tooltip-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 0.9rem 0.9rem 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tooltip-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.tooltip-close {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
    padding: 0;
}

.tooltip-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.tooltip-content {
    padding: 1.5rem;
}

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

.tooltip-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.tooltip-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

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

.tooltip-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.btn-small {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    min-width: 140px;
}

.btn-small:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--text-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

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

.guide-item {
    padding: 1rem;
    background: rgba(37, 99, 235, 0.05);
    border-radius: 0.5rem;
    border-left: 3px solid var(--primary-color);
}

.guide-item strong {
    display: block;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.guide-item p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Backdrop for tooltip */
.tooltip-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.tooltip-backdrop.active {
    display: block;
}

/* Responsive adjustments for nuclear chart */
@media (max-width: 768px) {
    .nuclear-chart-container {
        padding: 1rem;
        min-height: 400px;
    }

    .nucleus-tooltip {
        width: 95%;
        max-height: 90vh;
    }

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

    .tooltip-actions {
        flex-direction: column;
    }

    .btn-small {
        width: 100%;
    }

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