/* EPUB Migration Showcase - Clean Styles */

:root {
    --purple: #996189;
    --green: #4CAF50;
    --red: #F44336;
    --bg: #F5F5F5;
    --surface: #FFFFFF;
    --text: #212121;
    --text-light: #757575;
    --border: #E0E0E0;
    --radius: 8px;
}

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

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* Header */
.header {
    background: var(--purple);
    color: white;
    padding: 20px 24px;
    text-align: center;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
}

.header p {
    font-size: 14px;
    opacity: 0.85;
}

/* File Section */
.file-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.file-btn {
    background: var(--purple);
    color: white;
    padding: 10px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.file-btn:hover {
    background: #7d4f70;
}

.file-name {
    font-size: 14px;
    color: var(--text-light);
}

/* Selector Section */
.selector-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.selector-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.selector-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
}

.selector-group select {
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: white;
    min-width: 300px;
    cursor: pointer;
}

.selector-group select:focus {
    outline: none;
    border-color: var(--purple);
}

.selector-divider {
    color: var(--text-light);
    font-size: 13px;
}

/* Loading Bar */
.loading-bar {
    background: var(--purple);
    color: white;
    padding: 10px 20px;
    text-align: center;
    font-size: 14px;
}

.loading-text {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Viewers */
.viewers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.viewer {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.viewer-header {
    padding: 12px 16px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.viewer-header.bad {
    background: var(--red);
}

.viewer-header.good {
    background: var(--green);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.viewer-header .title {
    font-weight: 600;
    font-size: 15px;
}

.viewer-header .version {
    font-size: 11px;
    opacity: 0.8;
}

.viewer-header .tag {
    font-size: 11px;
    background: rgba(255,255,255,0.2);
    padding: 3px 10px;
    border-radius: 12px;
}

.epubjs-header {
    background: #607D8B;
}

.foliate-header {
    background: var(--green);
}

.viewer-content {
    height: 450px;
    background: white;
    position: relative;
}

.viewer-content iframe {
    width: 100%;
    height: 100%;
    border: none;
}

#epubjs-view {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.viewer-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.9);
    color: var(--text-light);
    font-size: 14px;
    z-index: 10;
}

.viewer-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress {
    font-size: 14px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.progress-info {
    font-size: 14px;
    display: flex;
    gap: 6px;
    align-items: center;
}

.progress-info .label {
    color: var(--text-light);
}

.progress-info .value {
    font-weight: 600;
}

.text-red {
    color: var(--red);
}

.text-green {
    color: var(--green);
}

.text-ok {
    color: var(--green);
}

.text-warn {
    color: #FF9800;
}

.bug-indicator {
    color: var(--red);
    font-size: 12px;
    cursor: help;
}

.nav {
    display: flex;
    gap: 8px;
}

.nav-buttons {
    display: flex;
    gap: 8px;
}

.nav button,
.nav-buttons button {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.nav button:hover:not(:disabled),
.nav-buttons button:hover:not(:disabled) {
    border-color: var(--purple);
    color: var(--purple);
}

.nav button:disabled,
.nav-buttons button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Research Findings Section */
.findings-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
}

.findings-section h2 {
    font-size: 20px;
    text-align: center;
    margin-bottom: 8px;
}

.findings-intro {
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 20px;
}

.bugs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.bug-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.bug-header {
    padding: 12px 16px;
    background: #FAFAFA;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bug-title {
    font-weight: 600;
    font-size: 14px;
}

.bug-impact {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.impact-high {
    background: #FFEBEE;
    color: var(--red);
}

.impact-security {
    background: #FFF3E0;
    color: #E65100;
}

.impact-medium {
    background: #FFF8E1;
    color: #F57C00;
}

.impact-low {
    background: #E8F5E9;
    color: var(--green);
}

.bug-content {
    padding: 14px 16px;
}

.bug-row {
    margin-bottom: 10px;
}

.bug-row:last-child {
    margin-bottom: 0;
}

.bug-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.epubjs-label {
    color: #607D8B;
}

.foliate-label {
    color: var(--green);
}

.bug-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
}

.bug-ref {
    padding: 8px 16px;
    background: #F5F5F5;
    font-size: 11px;
    color: var(--text-light);
    font-family: monospace;
}

/* Comparison Table */
.comparison {
    max-width: 800px;
    margin: 0 auto 40px;
    padding: 0 20px;
}

.comparison h2 {
    font-size: 20px;
    margin-bottom: 16px;
    text-align: center;
}

.comparison table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.comparison th,
.comparison td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.comparison th {
    background: var(--bg);
    font-weight: 500;
    font-size: 13px;
}

.comparison td {
    font-size: 14px;
}

.comparison tr:last-child td {
    border-bottom: none;
}

.comparison .bad {
    color: var(--red);
}

.comparison .good {
    color: var(--green);
    font-weight: 500;
}

/* Comparison Section */
.comparison-section {
    max-width: 900px;
    margin: 0 auto 40px;
    padding: 0 20px;
}

.comparison-section h2 {
    font-size: 20px;
    text-align: center;
    margin-bottom: 20px;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.comparison-table th,
.comparison-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.comparison-table th {
    background: var(--bg);
    font-weight: 500;
    font-size: 13px;
}

.comparison-table td {
    font-size: 14px;
}

.comparison-table tr:last-child td {
    border-bottom: none;
}

.comparison-table .winner {
    color: var(--green);
    font-weight: 500;
}

.comparison-table .loser {
    color: var(--text-light);
}

/* Empty State */
.empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-light);
    font-size: 16px;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    max-width: 500px;
    margin: 0 auto;
}

.empty-icon {
    width: 80px;
    height: 80px;
    background: var(--purple);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 600;
    margin: 0 auto 24px;
}

.empty-state h2 {
    font-size: 22px;
    margin-bottom: 12px;
}

.empty-state p {
    color: var(--text-light);
    font-size: 15px;
    margin-bottom: 8px;
}

.empty-hint {
    font-size: 13px !important;
    font-style: italic;
}

/* Footer */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 20px;
    text-align: center;
    margin-top: 40px;
}

.footer p {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 6px;
}

.footer-links a {
    color: var(--purple);
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* Bug Demonstration Banners */
.bug-banner {
    padding: 10px 14px;
    font-size: 12px;
    line-height: 1.4;
    border-bottom: 1px solid var(--border);
}

.bug-banner.warning {
    background: #FFF3E0;
    color: #E65100;
    border-color: #FFE0B2;
}

.bug-banner.error {
    background: #FFEBEE;
    color: var(--red);
    border-color: #FFCDD2;
}

.bug-banner.success {
    background: #E8F5E9;
    color: #2E7D32;
    border-color: #C8E6C9;
}

.bug-banner code {
    background: rgba(0,0,0,0.08);
    padding: 1px 4px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 11px;
}

/* Progress Bar Visualization */
.progress-bar-container {
    flex: 1;
    margin: 0 12px;
}

.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

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

.progress-bar-fill.green {
    background: var(--green);
}

.progress-bar-fill.red {
    background: var(--red);
}

.progress-bar-fill.stuck {
    animation: pulse-red 1s infinite;
}

@keyframes pulse-red {
    0%, 100% { opacity: 1; background: var(--red); }
    50% { opacity: 0.6; background: #FF8A80; }
}

.progress-bar-fill.complete {
    background: var(--green);
    animation: pulse-green 0.5s ease;
}

@keyframes pulse-green {
    0% { transform: scaleX(0.98); }
    50% { transform: scaleX(1.02); }
    100% { transform: scaleX(1); }
}

/* Progress Status Labels */
.progress-status {
    font-size: 11px;
    margin-top: 4px;
}

.progress-status.stuck {
    color: var(--red);
    font-weight: 600;
}

.progress-status.complete {
    color: var(--green);
    font-weight: 600;
}

/* Live Progress Comparison Strip */
.progress-comparison {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.progress-comparison-inner {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.progress-comparison h3 {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 12px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.progress-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 12px;
}

.progress-row:last-child {
    margin-bottom: 0;
}

.progress-row .lib-name {
    width: 100px;
    font-size: 13px;
    font-weight: 600;
}

.progress-row .lib-name.epubjs {
    color: #607D8B;
}

.progress-row .lib-name.foliate {
    color: var(--green);
}

.progress-row .progress-bar {
    flex: 1;
    height: 20px;
}

.progress-row .progress-bar-fill {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    color: white;
    font-size: 11px;
    font-weight: 600;
}

.progress-row .status-tag {
    width: 100px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    padding: 4px 8px;
    border-radius: 4px;
}

.progress-row .status-tag.stuck {
    background: #FFEBEE;
    color: var(--red);
}

.progress-row .status-tag.complete {
    background: #E8F5E9;
    color: var(--green);
}

.progress-row .status-tag.reading {
    background: #E3F2FD;
    color: #1976D2;
}

/* Memory Demo Button and Panels */
.memory-demo-section {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
}

/* Bug Panel Section */
.bug-panel-section {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
}

.bug-panel-heading {
    font-size: 18px;
    text-align: center;
    margin-bottom: 20px;
    color: var(--text);
}

.bug-panel-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.bug-panel-card {
    background: var(--surface);
    border-radius: var(--radius);
    border-left: 4px solid var(--red);
    padding: 16px;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.15);
    animation: slide-in 0.3s ease-out;
}

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

.bug-card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

.bug-card-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.4;
}

.bug-card-row.epubjs-row {
    color: var(--red);
}

.bug-card-row.foliate-row {
    color: var(--green);
}

.bug-card-icon {
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.bug-card-label {
    font-weight: 600;
    flex-shrink: 0;
}

.bug-card-text {
    flex: 1;
}

.bug-card-code {
    font-family: monospace;
    font-size: 11px;
    background: #F5F5F5;
    padding: 6px 8px;
    border-radius: 4px;
    margin: 8px 0;
    color: var(--text-light);
}

.bug-card-links {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.bug-card-links a {
    font-size: 12px;
    color: var(--purple);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.bug-card-links a:hover {
    color: #7d4f70;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .bug-panel-cards {
        grid-template-columns: 1fr;
    }
}

.memory-demo-btn {
    display: block;
    width: 100%;
    padding: 14px 20px;
    background: #607D8B;
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.memory-demo-btn:hover {
    background: #546E7A;
}

.memory-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 16px;
}

.memory-panel {
    padding: 16px;
    border-radius: var(--radius);
    font-size: 13px;
}

.memory-panel.leak {
    background: #FFEBEE;
    border: 2px solid var(--red);
}

.memory-panel.clean {
    background: #E8F5E9;
    border: 2px solid var(--green);
}

.memory-panel h4 {
    font-size: 14px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.memory-panel.leak h4 {
    color: var(--red);
}

.memory-panel.clean h4 {
    color: var(--green);
}

.memory-panel ul {
    list-style: none;
    margin-bottom: 10px;
}

.memory-panel li {
    padding: 4px 0;
    font-family: monospace;
    font-size: 12px;
}

.memory-panel .source {
    font-size: 11px;
    color: var(--text-light);
    font-style: italic;
}

/* Auto-load Note */
.auto-load-note {
    background: #E3F2FD;
    color: #1565C0;
    padding: 10px 16px;
    font-size: 13px;
    text-align: center;
    border-bottom: 1px solid #BBDEFB;
}

.auto-load-note strong {
    font-weight: 600;
}

/* Viewer Banners Stack */
.viewer-banners {
    max-height: 120px;
    overflow-y: auto;
}

/* Enhanced Viewer Footer */
.viewer-footer-enhanced {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.viewer-footer-enhanced .progress-section {
    margin-bottom: 8px;
}

.viewer-footer-enhanced .progress-label {
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.viewer-footer-enhanced .progress-detail {
    font-size: 10px;
    color: var(--text-light);
    margin-top: 4px;
    font-family: monospace;
    line-height: 1.4;
}

.viewer-footer-enhanced .nav-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Mobile */
@media (max-width: 768px) {
    .viewers {
        grid-template-columns: 1fr;
    }

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

    .viewer-content {
        height: 350px;
    }

    .file-section,
    .selector-section {
        flex-direction: column;
    }

    .selector-group select {
        min-width: 100%;
    }

    .memory-panels {
        grid-template-columns: 1fr;
    }

    .progress-row {
        flex-wrap: wrap;
    }

    .progress-row .lib-name {
        width: 80px;
    }

    .progress-row .status-tag {
        width: 80px;
    }
}
