/* Modern Workout Analyzer - Green/Black Theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-green: #00ff88;
    --dark-green: #00cc6a;
    --light-green: #4dffa6;
    --accent-green: #00ffaa;
    --neon-green: #39ff14;

    --bg-black: #0a0a0a;
    --bg-dark: #111111;
    --bg-card: #161616;
    --bg-secondary: #1a1a1a;
    --bg-hover: #222222;

    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #666666;

    --border-color: #333333;
    --border-green: #00ff8844;

    --shadow-green: 0 0 20px rgba(0, 255, 136, 0.3);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.8);
    --shadow-glow: 0 0 40px rgba(0, 255, 136, 0.2);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-black);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 80%, rgba(0, 255, 136, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(0, 255, 136, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(0, 204, 106, 0.1) 0%, transparent 50%);
    z-index: -1;
    animation: pulse 8s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* Header Styles */
.header {
    background: rgba(22, 22, 22, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-green);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-glow);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-green), var(--neon-green));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--bg-black);
    box-shadow: var(--shadow-green);
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-green), var(--light-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

/* Navigation */
.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
}

.nav-buttons {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 136, 0.1), transparent);
    transition: left 0.5s ease;
}

.nav-btn:hover::before {
    left: 100%;
}

.nav-btn:hover {
    border-color: var(--primary-green);
    color: var(--primary-green);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
    transform: translateY(-2px);
}

.nav-btn.active {
    background: linear-gradient(135deg, var(--primary-green), var(--dark-green));
    border-color: var(--primary-green);
    color: var(--bg-black);
    font-weight: 600;
    box-shadow: var(--shadow-green);
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 2rem;
    min-height: calc(100vh - 200px);
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Upload Container */
.upload-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 2rem;
    text-align: center;
}

/* API Key Section */
.api-key-section {
    margin: 2rem 0;
    text-align: left;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.api-key-label {
    display: block;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.api-key-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.api-key-input:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.1);
}

.api-key-input::placeholder {
    color: var(--text-secondary);
}

.api-key-help {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.api-key-help a {
    color: var(--primary-green);
    text-decoration: none;
}

.api-key-help a:hover {
    text-decoration: underline;
}

/* Privacy Notice Checkbox */
.privacy-notice-section {
    margin: 1rem 0;
    padding: 1rem;
    background: rgba(220, 38, 38, 0.1);
    border: 2px solid #dc2626;
    border-radius: 8px;
}

.privacy-checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    gap: 0.75rem;
}

.privacy-checkbox {
    margin: 0;
    margin-top: 0.2rem;
    width: 18px;
    height: 18px;
    accent-color: #dc2626;
    flex-shrink: 0;
}

.privacy-notice {
    color: white !important;
    font-weight: 700 !important;
    font-size: 0.95rem;
    line-height: 1.4;
}

.privacy-notice strong {
    font-weight: 800;
}

.upload-header {
    margin-bottom: 3rem;
}

.upload-header h2 {
    color: var(--text-primary);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-green), var(--light-green));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.upload-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

/* Google-style Button Row */
.button-row {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    align-items: center;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.upload-btn,
.analyze-btn {
    background: linear-gradient(135deg, var(--primary-green), var(--dark-green));
    color: var(--bg-black);
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.3);
    min-width: 180px;
    text-transform: none;
    letter-spacing: normal;
}

.upload-btn:hover:not(:disabled),
.analyze-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 255, 136, 0.4);
}

.analyze-btn:disabled {
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

/* Glowing animation for loading state */
.analyze-btn.loading {
    animation: glowPulse 1.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 40px rgba(0, 255, 136, 0.8), 0 0 60px rgba(0, 255, 136, 0.6);
        transform: scale(1.02);
    }
}

/* Video Preview Section */
.video-preview-section {
    margin-top: 2rem;
}

.preview-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-green);
    text-align: center;
}

.preview-container h3 {
    color: var(--primary-green);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.video-preview {
    width: 100%;
    max-width: 500px;
    height: auto;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    background: var(--bg-black);
}

.video-info {
    margin-bottom: 2rem;
    text-align: left;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.video-info p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}


.upload-area h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-green), var(--light-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.upload-area p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.upload-btn {
    background: linear-gradient(135deg, var(--primary-green), var(--dark-green));
    color: var(--bg-black);
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-green);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.4);
}

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

#file-input {
    display: none;
}

/* Results Container */
.results-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: var(--shadow-card);
    margin-bottom: 2rem;
}

.results-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.results-header h2 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-green), var(--light-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

/* Fix emoji visibility in headers */
.results-header h2 .emoji,
.history-container h2 .emoji {
    -webkit-text-fill-color: initial;
    background: none;
    -webkit-background-clip: initial;
    background-clip: initial;
}

/* Analysis Summary */
.analysis-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-green), var(--neon-green));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-card:hover {
    border-color: var(--primary-green);
    transform: translateY(-5px);
    box-shadow: var(--shadow-green);
}

.stat-card h3 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-green);
    margin-bottom: 0.5rem;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.stat-card p {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
}

/* Analysis Sections */
.analysis-section {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 1rem 0;
    margin-bottom: 2rem;
    position: relative;
    overflow: visible;
}

.analysis-section::before {
    display: none;
}

.analysis-section:hover::before {
    display: none;
}

.analysis-section h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-green);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.analysis-section h3::before {
    content: '';
    width: 4px;
    height: 1.5rem;
    background: linear-gradient(135deg, var(--primary-green), var(--neon-green));
    border-radius: 2px;
}

/* Form Analysis Frames */
.frame-comparison {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 1rem 0;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.frame-comparison:hover {
    border-color: transparent;
    box-shadow: none;
}

.frame-info h4 {
    color: var(--primary-green);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.frame-info p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.frame-info small {
    color: var(--text-muted);
    font-size: 1.0rem;
}

/* Major fault title styling */
.major-fault-title {
    color: #ff4444 !important;
    font-weight: 700 !important;
}

/* === NEW ANALYSIS LAYOUT STYLES === */

/* Main analysis layout */
.analysis-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    min-height: 600px;
}

/* Sidebar navigation */
.analysis-sidebar {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border-green);
    box-shadow: var(--shadow-card);
    height: fit-content;
    position: sticky;
    top: 2rem;
}

.analysis-sidebar h4 {
    color: var(--primary-green);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-green);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary-green), var(--dark-green));
    border-color: var(--primary-green);
    color: var(--bg-black);
    font-weight: 600;
    box-shadow: var(--shadow-green);
}

/* Main content area */
.analysis-main {
    background: transparent;
    border-radius: 0;
    padding: 0;
    border: none;
    box-shadow: none;
}

/* Global score highlighting */
.global-score {
    background: linear-gradient(135deg, var(--primary-green), var(--dark-green));
    color: var(--bg-black);
}

.global-score h3 {
    color: var(--bg-black) !important;
    font-weight: 800;
}

.global-score p {
    color: var(--bg-black) !important;
    font-weight: 600;
}

/* Fault count cards */
.major-faults {
    background: linear-gradient(135deg, #ff4444, #ff6b6b);
    color: var(--bg-black);
}

.major-faults h3 {
    color: var(--bg-black) !important;
    font-weight: 800;
}

.major-faults p {
    color: var(--bg-black) !important;
    font-weight: 600;
}

.minor-faults {
    background: linear-gradient(135deg, #ffc107, #ffd54f);
    color: var(--bg-black);
}

.minor-faults h3 {
    color: var(--bg-black) !important;
    font-weight: 800;
}

.minor-faults p {
    color: var(--bg-black) !important;
    font-weight: 600;
}

/* Scoring chart */
.scoring-chart-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.scoring-chart {
    margin-top: 1rem;
}

.chart-container {
    display: flex;
    align-items: end;
    gap: 1rem;
    height: 200px;
    position: relative;
    padding: 20px 0;
    border-bottom: 2px solid var(--border-color);
}

.chart-bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    height: 100%;
}

.chart-bar {
    width: 100%;
    max-width: 60px;
    background: var(--bg-hover);
    border-radius: 4px 4px 0 0;
    position: relative;
    display: flex;
    align-items: end;
    justify-content: center;
    padding-bottom: 5px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.chart-bar.above-median {
    background: linear-gradient(135deg, var(--primary-green), var(--light-green));
}

.chart-bar.below-median {
    background: linear-gradient(135deg, #ff6b6b, #ff8787);
}

.chart-bar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.3);
}

.bar-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--bg-black);
}

.bar-label {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.median-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--neon-green);
    box-shadow: 0 0 6px var(--neon-green);
}

.median-label {
    position: absolute;
    right: 0;
    top: -20px;
    font-size: 0.85rem;
    color: var(--neon-green);
    font-weight: 600;
    background: var(--bg-card);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Consolidated sections */
.consolidated-priorities,
.consolidated-issues {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.priorities-list-consolidated,
.issues-list-consolidated {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.priority-item-consolidated {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.priority-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.priority-scope {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--bg-hover);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.issue-item-consolidated {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.issue-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.75rem;
}

.issue-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.issue-frequency {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.count-badge {
    background: var(--primary-green);
    color: var(--bg-black);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.8rem;
}

.rep-list {
    color: var(--text-muted);
}

/* Rep analysis view */
.rep-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.rep-score {
    text-align: center;
}

.score-value {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-green);
}

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

.rep-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-item label {
    font-weight: 600;
    color: var(--text-primary);
}

.stat-item span {
    color: var(--text-secondary);
}

/* Issue gallery */
.rep-issues {
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
}

.issue-gallery-item {
    margin-bottom: 2rem;
    padding: 0;
    background: transparent;
    border-radius: 0;
    border: none;
}

.issue-image-container {
    margin-bottom: 1rem;
    padding: 0;
}

.image-comparison {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    max-width: 100%;
}

.image-comparison-two {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    max-width: 100%;
}

@media (max-width: 1024px) {
    .image-comparison {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

    .image-comparison-two {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.image-item {
    text-align: center;
}

.image-item h6 {
    color: var(--primary-green);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.image-item img {
    width: 100%;
    height: 350px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease;
    background: var(--bg-black);
}

.image-item img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.3);
}

@media (max-width: 768px) {
    .image-item img {
        height: 280px;
    }
}

.issue-details {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.issue-correction {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border-left: 3px solid var(--primary-green);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
}

.rep-success {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.1), rgba(77, 255, 166, 0.1));
    border: 1px solid var(--primary-green);
    border-radius: 12px;
}

.rep-success h4 {
    color: var(--primary-green);
    margin-bottom: 0.5rem;
}

.no-data {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 1rem;
}

/* Responsive design for analysis layout */
@media (max-width: 768px) {
    .analysis-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .analysis-sidebar {
        position: static;
        order: 2;
    }

    .nav-menu {
        flex-direction: row;
        overflow-x: auto;
        gap: 0.25rem;
    }

    .nav-item {
        white-space: nowrap;
        min-width: fit-content;
    }

    .chart-container {
        height: 150px;
    }

    .image-comparison {
        grid-template-columns: 1fr;
    }
}

.frame-images-triple {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 2rem;
}

.frame-images-two {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
    padding: 0;
    align-items: flex-start;
    width: 100%;
    justify-content: center;
}

@media (max-width: 1024px) {
    .frame-images-triple {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .frame-images-triple {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .frame-images-two {
        flex-direction: column;
        gap: 1rem;
        margin: 1rem 0;
        padding: 0;
        justify-content: center;
    }

    .full-size-image {
        width: 100% !important;
        max-width: 400px !important;
        margin: 0 auto !important;
    }
}

.original-frame,
.annotated-frame,
.corrected-frame {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    text-align: center;
    transition: all 0.3s ease;
}

.original-frame:hover,
.annotated-frame:hover,
.corrected-frame:hover {
    transform: none;
    box-shadow: none;
}

.original-frame h5,
.annotated-frame h5,
.corrected-frame h5 {
    background: linear-gradient(135deg, var(--primary-green), var(--light-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
    margin-bottom: 1rem;
    padding: 0.75rem 0;
    border-radius: 0;
    background-color: transparent;
}

.frame-images-triple img:not(.full-size-image),
.frame-images-two img:not(.full-size-image) {
    width: auto;
    max-width: none;
    height: auto;
    object-fit: contain;
    border-radius: 0;
    border: none;
    transition: all 0.3s ease;
    background: transparent;
}

.full-size-image {
    width: calc(50% - 0.5rem) !important;
    min-width: 250px !important;
    max-width: 500px !important;
    height: auto !important;
    max-height: none !important;
    object-fit: contain !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    display: block !important;
}

.frame-images-triple img:not(.full-size-image):hover,
.frame-images-two img:not(.full-size-image):hover {
    border-color: transparent;
    box-shadow: none;
    transform: none;
}

/* Fault Annotations */
.fault-annotations {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid var(--primary-green);
    border-radius: 8px;
    text-align: left;
}

.fault-annotations h6 {
    color: var(--primary-green);
    font-size: 1.0rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.fault-item {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.fault-item strong {
    color: var(--primary-green);
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

/* History Container */
.history-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: var(--shadow-card);
}

.history-container h2 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-green), var(--light-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2rem;
    text-align: center;
}

.history-list {
    display: grid;
    gap: 1.5rem;
}

.history-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
}

.history-content {
    flex: 1;
    padding: 2rem;
    cursor: pointer;
}

.history-actions {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-left: 1px solid var(--border-color);
}

.delete-btn {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-hover));
    border: 1px solid var(--border-color);
    color: #ff8a8a;
    padding: 0;
    border-radius: 12px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.delete-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 138, 138, 0.2), transparent);
    transition: left 0.6s ease;
}

.delete-btn:hover::before {
    left: 100%;
}

.delete-btn:hover {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.15), rgba(255, 138, 138, 0.25));
    border-color: #ff8a8a;
    transform: translateY(-2px) scale(1.05);
    color: #ff6b6b;
    box-shadow:
        0 8px 25px rgba(255, 107, 107, 0.4),
        0 4px 12px rgba(255, 107, 107, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.delete-btn:active {
    transform: translateY(0) scale(0.98);
    transition: all 0.15s ease;
}

.delete-btn:focus {
    outline: none;
    box-shadow:
        0 8px 25px rgba(255, 107, 107, 0.4),
        0 0 0 3px rgba(255, 107, 107, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.delete-btn svg {
    transition: all 0.3s ease;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.delete-btn:hover svg {
    transform: scale(1.1);
    filter: drop-shadow(0 2px 4px rgba(255, 107, 107, 0.3));
}

.history-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 136, 0.1), transparent);
    transition: left 0.5s ease;
}

.history-content:hover::before {
    left: 100%;
}

.history-content:hover {
    background: var(--bg-hover);
}

.history-item:hover {
    border-color: var(--primary-green);
    transform: translateY(-3px);
    box-shadow: var(--shadow-green);
}


.history-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.history-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-green);
}

.history-date {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.history-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.history-id {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    background: var(--bg-black);
    border: 1px solid var(--border-green);
    color: var(--primary-green);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
}

.history-faults {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid #ffc107;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #ffc107;
}

/* Loading and Error States */
.loading {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 1rem;
    vertical-align: middle;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    color: #fca5a5;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        padding: 2rem 1rem;
    }

    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .frame-images-triple {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .analysis-summary {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 768px) {

    .upload-container,
    .results-container,
    .history-container {
        padding: 2rem 1rem;
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    .upload-area h2 {
        font-size: 1.75rem;
    }

    .results-header h2,
    .history-container h2 {
        font-size: 2rem;
    }

    .stat-card h3 {
        font-size: 2rem;
    }

    .nav-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }

    .frame-images-triple {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--light-green);
}

/* Additional Analysis Styles */
.priorities-list,
.faults-list {
    display: grid;
    gap: 1rem;
}

.priority-item,
.fault-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease;
}

.priority-item:hover,
.fault-item:hover {
    border-color: var(--primary-green);
    transform: translateX(5px);
}

.priority-item strong,
.fault-item strong {
    color: var(--primary-green);
    display: block;
    margin-bottom: 0.5rem;
}

/* Fault severity styling */
.fault-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.fault-description {
    color: var(--text-secondary);
    line-height: 1.5;
}

.severity-badge {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Major severity - Red */
.fault-item.severity-major {
    border-left: 4px solid #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.fault-item.severity-major .fault-header strong {
    color: #ef4444 !important;
}

.severity-badge.severity-major {
    background: #ef4444;
    color: white;
}

/* Medium severity - Yellow/Orange */
.fault-item.severity-medium {
    border-left: 4px solid #f59e0b;
    background: rgba(245, 158, 11, 0.05);
}

.fault-item.severity-medium .fault-header strong {
    color: #f59e0b !important;
}

.severity-badge.severity-medium {
    background: #f59e0b;
    color: white;
}

/* Minor severity - Orange */
.fault-item.severity-minor {
    border-left: 4px solid #f97316;
    background: rgba(249, 115, 22, 0.05);
}

.fault-item.severity-minor .fault-header strong {
    color: #f97316 !important;
}

.severity-badge.severity-minor {
    background: #f97316;
    color: white;
}

.success-message {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--primary-green);
    color: var(--primary-green);
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
}

.advice-list {
    list-style: none;
    padding: 0;
}

.advice-list li {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    position: relative;
    padding-left: 2.5rem;
    transition: all 0.3s ease;
}

.advice-list li:hover {
    border-color: var(--primary-green);
    transform: translateX(5px);
}

.advice-list li::before {
    content: '💡';
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

.json-viewer {
    background: var(--bg-black);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    overflow-x: auto;
    max-height: 400px;
}

details summary {
    color: var(--primary-green);
    cursor: pointer;
    font-weight: 600;
    padding: 0.5rem 0;
    user-select: none;
}

details summary:hover {
    color: var(--light-green);
}

.annotation-text,
.correction-text {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 2rem 1rem;
    border-radius: 8px;
    text-align: center;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    color: #fca5a5;
    padding: 2rem 1rem;
    border-radius: 8px;
    text-align: center;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Selection Styling */
::selection {
    background: rgba(0, 255, 136, 0.3);
    color: var(--text-primary);
}

/* Loading States */
.analysis-loading {
    text-align: center;
    padding: 4rem 2rem;
}

.loading-spinner {
    width: 80px;
    height: 80px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 2rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.analysis-loading h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.analysis-loading p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 300px;
    margin: 0 auto;
}

.step {
    padding: 0.8rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.step.active {
    border-color: var(--primary-green);
    color: var(--primary-green);
    background: rgba(0, 255, 136, 0.1);
}

.step.completed {
    border-color: var(--dark-green);
    color: var(--dark-green);
    background: rgba(0, 204, 106, 0.1);
}

/* Frame placeholder for when no frame is available */
.frame-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    margin: 1rem 0;
}

.placeholder-content {
    text-align: center;
    color: var(--text-muted);
}

.placeholder-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.placeholder-content p {
    margin: 0.5rem 0;
    font-weight: 500;
    color: var(--text-secondary);
}

.placeholder-content small {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Image titles for corrected frames */
.image-with-title {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.image-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    padding: 0.5rem 0;
    text-align: center;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

/* Responsive loading adjustments */
@media (max-width: 768px) {
    .analysis-loading {
        padding: 3rem 1rem;
    }

    .loading-spinner {
        width: 60px;
        height: 60px;
    }

    .image-title {
        font-size: 0.9rem;
        padding: 0.4rem 0;
    }
}