/* This file contains the styles for the SVD Image Compressor project */

body {
    font-family: Arial, sans-serif;
    background-color: transparent;
    margin: 0;
    padding: 0;
}

h1 {
    text-align: center;
    color: #333;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.8);
    font-weight: bold;
    margin-bottom: 30px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: transparent;
    border-radius: 8px;
    box-shadow: none;
    border: 1px solid transparent;
    /*backdrop-filter: blur(10px); /* 增强模糊效果 */
}

.upload-section {
    margin-bottom: 20px;
}

.upload-section input[type="file"] {
    display: block;
    margin: 0 auto;
}

.slider {
    width: 100%;
    margin: 20px 0;
}

.button {
    display: block;
    width: 100%;
    padding: 10px;
    background-color: rgba(0, 123, 255, 0.8); /* 半透明背景 */
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    backdrop-filter: blur(5px);
}

.button:hover {
    background-color: rgba(0, 86, 179, 0.9); /* 悬停时稍微增加不透明度 */
}

.result-section {
    text-align: center;
}

.result-section img {
    max-width: 100%;
    border-radius: 8px;
}

.analysis-container {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05); /* 更透明 */
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.info-section {
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05); /* 更透明 */
    border-radius: 5px;
    border-left: 4px solid rgba(0, 123, 255, 0.8);
    backdrop-filter: blur(10px);
}

.info-section h4 {
    margin: 0 0 10px 0;
    color: #495057;
}

.info-section p {
    margin: 5px 0;
    font-size: 14px;
}

.chart-container {
    display: flex;
    align-items: flex-end;
    height: 100px;
    gap: 2px;
    margin: 10px 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05); /* 更透明 */
    border-radius: 4px;
    backdrop-filter: blur(10px);
}

.chart-bar {
    flex: 1;
    min-height: 5px;
    border-radius: 2px;
    transition: opacity 0.3s;
}

.chart-bar.used-important {
    background: linear-gradient(135deg, #0c1ae2, #3481ce);
    box-shadow: 0 2px 4px rgba(9, 141, 235, 0.3);
}

.chart-bar.used {
    background-color: #28a745;
}

.chart-bar.unused {
    background-color: #dc3545;
    opacity: 0.3;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #495057;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    display: inline-block;
}

.legend-color.used-important {
    background: linear-gradient(135deg, #138ce3, #171bde);
}

.legend-color.used {
    background-color: #28a745;
}

.legend-color.unused {
    background-color: #dc3545;
    opacity: 0.3;
}

.chart-description {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
    text-align: center;
    font-style: italic;
}

.image-containers {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.image-box {
    flex: 1;
    min-width: 300px;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    /*backdrop-filter: blur(10px);*/
}

/* 动画容器样式 */
.animation-container {
    padding: 20px;
    background: transparent; 
    border-radius: 10px;
    border: 2px solid rgba(0, 123, 255, 0.6);
    backdrop-filter: blur(10px);
}

.animation-header {
    text-align: center;
    margin-bottom: 15px;
}

.animation-header h4 {
    margin: 0 0 10px 0;
    color: #007bff;
    font-size: 18px;
}

.animation-controls {
    font-size: 16px;
    font-weight: bold;
    color: #495057;
}

.progress-section {
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 25px;
    background-color: rgba(233, 236, 239, 0.3); 
    border-radius: 12px;
    overflow: hidden;
    margin: 10px 0;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    backdrop-filter: blur(5px);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #28a745);
    border-radius: 12px;
    transition: width 0.3s ease-in-out;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(
        -45deg,
        rgba(255, 255, 255, .2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, .2) 50%,
        rgba(255, 255, 255, .2) 75%,
        transparent 75%,
        transparent
    );
    background-size: 50px 50px;
    animation: move 2s linear infinite;
}

@keyframes move {
    0% { background-position: 0 0; }
    100% { background-position: 50px 50px; }
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

.image-display {
    text-align: center;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.animation-frame {
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    max-width: 100%;
    height: auto;
}

/* 奇异值详细信息样式 */
.singular-values-details {
    margin-top: 15px;
    padding: 10px;
    background: transparent;
    border-radius: 6px;
    border: 1px solid rgba(248, 249, 250, 0.3);
    backdrop-filter: blur(5px);
}

.singular-values-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    margin: 10px 0;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.singular-value-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.1); /* 稍微增加一点不透明度保证可读性 */
    border-radius: 4px;
    font-size: 12px;
    border-left: 3px solid #28a745;
    backdrop-filter: blur(5px);
}

.sv-index {
    font-weight: bold;
    color: #495057;
    min-width: 30px;
}

.sv-value {
    font-family: monospace;
    color: #007bff;
    font-weight: 500;
}

.sv-energy {
    color: #28a745;
    font-size: 11px;
    font-weight: 500;
}

.energy-summary {
    text-align: center;
    padding: 10px;
    background: rgba(227, 242, 253, 0.3); /* 半透明背景 */
    border-radius: 4px;
    margin-top: 10px;
    color: #1976d2;
    border: 1px solid rgba(187, 222, 251, 0.5);
    backdrop-filter: blur(5px);
}

.energy-breakdown {
    margin-top: 15px;
    padding: 10px;
    background: rgba(255, 243, 205, 0.3); /* 半透明背景 */
    border-radius: 4px;
    border: 1px solid rgba(255, 234, 167, 0.5);
    backdrop-filter: blur(5px);
}

.energy-breakdown ul {
    margin: 5px 0;
    padding-left: 20px;
}

.energy-breakdown li {
    margin: 3px 0;
    font-size: 13px;
    color: #856404;
}

/* 按钮禁用状态 */
button:disabled {
    background-color: rgba(108, 117, 125, 0.6) !important; /* 半透明禁用 */
    cursor: not-allowed;
    opacity: 0.6;
    transform: none !important;
}

input[type="range"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 侧边栏样式 */
.sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100vh;
    background: linear-gradient(180deg, 
        rgba(0, 123, 255, 0.9) 0%, 
        rgba(0, 86, 179, 0.9) 100%); /* 半透明渐变背景 */
    color: white;
    transition: left 0.3s ease-in-out;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.sidebar-header h3 {
    margin: 0;
    color: white;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.close-btn:hover {
    background-color: rgba(255,255,255,0.2);
}

.sidebar-content {
    padding: 20px 0;
}

.sidebar-content nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-content nav li {
    margin: 0;
}

.sidebar-link {
    display: block;
    padding: 15px 20px;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
    border-left-color: white;
}

.sidebar-link.active {
    background-color: rgba(255,255,255,0.2);
    color: white;
    border-left-color: white;
    font-weight: bold;
}

/* 主内容区域 */
.main-content {
    transition: margin-left 0.3s ease-in-out;
    min-height: 100vh;
    background: transparent; }

.main-content.shifted {
    margin-left: 300px;
}

/* 菜单切换按钮 */
.menu-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(0, 123, 255, 0.8); 
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 18px;
    z-index: 999;
    transition: all 0.3s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
}

.menu-toggle:hover {
    background: rgba(0, 86, 179, 0.9); 
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.menu-toggle.hidden {
    left: -100px;
}

/* 侧边栏遮罩层 */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 首页背景 */
.homepage {
    background-image: url('images/homepage-bg.jpg');
    background-size: 100% auto; 
    background-position: center top; 
    background-repeat: no-repeat;
    background-attachment: scroll;
}

.homepage * {
    color: #95276c !important; 
    text-shadow: 
        1px 1px 3px rgba(255, 255, 255, 0.5),
        -1px -1px 3px rgba(255, 255, 255, 0.5),
        1px -1px 3px rgba(255, 255, 255, 0.5),
        -1px 1px 3px rgba(255, 255, 255, 0.5);
}

.main-page {
    background-image: url('images/main-bg.jpeg');
    background-size: 100% auto; 
    background-position: center top;
    background-repeat: no-repeat;
    background-attachment: scroll;
}

.main-page * {
    color: #9c072c !important; 
    text-shadow: 
        1px 1px 2px rgba(255, 255, 255, 0.1),
        -1px -1px 2px rgba(255, 255, 255, 0.1),
        1px -1px 2px rgba(255, 255, 255, 0.1),
        -1px 1px 2px rgba(255, 255, 255, 0.1);
}

/* 理论页面 */
.theory-page {
    background-image: url('images/theory-bg.jpg');
    background-size: 100% auto; 
    background-position: center top;
    background-repeat: no-repeat;
    background-attachment: scroll;
}

.theory-page * {
    color: #702978 !important;
    text-shadow: 
        1px 1px 3px rgba(255, 255, 255, 0.2),
        -1px -1px 3px rgba(255, 255, 255, 0.2),
        1px -1px 3px rgba(255, 255, 255, 0.2),
        -1px 1px 3px rgba(255, 255, 255, 0.2);
}

/* 响应设计 */
@media (max-width: 768px) {
    .image-containers {
        flex-direction: column;
    }
    
    .progress-info {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
    
    .animation-container {
        padding: 15px;
    }
    
    .singular-values-grid {
        grid-template-columns: 1fr;
        max-height: 200px;
    }
    
    .chart-legend {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .singular-value-item {
        font-size: 11px;
    }
    
    .sidebar {
        width: 280px;
        left: -280px;
    }
    
    .main-content.shifted {
        margin-left: 0;
    }
    
    .menu-toggle {
        top: 15px;
        left: 15px;
        padding: 8px 12px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100%;
        left: -100%;
    }
}