/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #2d3748;
    line-height: 1.6;
    min-height: 100vh;
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    color: #2563eb;
}

.logo-icon {
    width: 28px;
    height: 28px;
}

.logo-link {
    text-decoration: none;
    color: inherit;
}

.logo-text-container {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.logo-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2563eb;
}

.logo-url {
    font-size: 0.75rem; /* Smaller font size */
    font-weight: 400;
    color: #9ca3af;
    margin-left: 0; /* Remove side margin */
}

.upload-url {
    font-size: 1rem;
    font-weight: 500;
    color: #9ca3af;
    margin-bottom: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
}

.btn-secondary {
    background: white;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-icon {
    padding: 0.75rem;
    min-width: auto;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Upload Area */
.upload-area {
    background: white;
    border: 2px dashed #cbd5e1;
    border-radius: 1rem;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #3b82f6;
    background: #f8fafc;
    transform: translateY(-2px);
}

.upload-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #374151;
}

.upload-content p {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.upload-icon {
    margin-bottom: 1rem;
}

.upload-icon i {
    width: 48px;
    height: 48px;
    color: #9ca3af;
}

/* Viewer Container */
.viewer-container {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Control Panel */
.control-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 1rem;
}

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

.control-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.select-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background: white;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
}

.select-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Canvas Container */
.canvas-container {
    position: relative;
    height: 60vh;
    min-height: 400px;
    background: #000;
    overflow: hidden;
}

.canvas-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Info Panel */
.info-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 1rem;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.info-label {
    font-weight: 500;
    color: #6b7280;
}

.info-value {
    color: #374151;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.5rem 0;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #374151;
}

.modal-body {
    padding: 1.5rem;
}

.help-section {
    margin-bottom: 1.5rem;
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
}

.help-section ul {
    list-style: none;
    padding-left: 0;
}

.help-section li {
    padding: 0.25rem 0;
    color: #6b7280;
    position: relative;
    padding-left: 1.5rem;
}

.help-section li::before {
    content: '•';
    color: #3b82f6;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.loading-content p {
    color: #6b7280;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .header-actions {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
        align-items: center;
    }
    
    #loadTestImageBtn {
        background: linear-gradient(135deg, #10b981 0%, #059669 100%);
        color: white;
        border: none;
    }
    
    #loadTestImageBtn:hover {
        background: linear-gradient(135deg, #059669 0%, #047857 100%);
    }

    .main-content {
        padding: 0.75rem;
    }
    
    .upload-area {
        padding: 1.5rem 1rem;
    }
    
    .upload-content h3 {
        font-size: 1.25rem;
    }
    
    .upload-content p {
        font-size: 0.875rem;
    }
    
    .control-panel {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }
    
    .control-group {
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .control-group:first-child {
        order: 1;
    }
    
    .control-group:last-child {
        order: 3;
    }
    
    .control-group:nth-child(2) {
        order: 2;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .canvas-container {
        height: 60vh;
        min-height: 300px;
    }
    
    .info-panel {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
    }
    
    .info-item {
        font-size: 0.8rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        min-height: 40px;
        white-space: nowrap;
    }
    
    .btn-icon {
        padding: 0.625rem;
        min-width: 40px;
    }
    
    /* 确保按钮文本不溢出 */
    .header-actions .btn {
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.25rem;
    }
    
    .header-content {
        padding: 0.5rem;
    }
    
    .header-actions {
        flex-direction: column;
        width: 100%;
        gap: 0.25rem;
    }
    
    .header-actions .btn, .header-actions .dropdown {
        width: 100%;
    }

    .header-actions .btn {
        width: 100%;
        justify-content: center; /* Center all buttons */
    }

    .header-actions .dropdown {
        width: 100%;
    }
    
    .header-actions .dropdown .btn {
        width: 100%;
        justify-content: center;
    }
    
    .stats-display {
        margin-right: 0;
        margin-bottom: 0.5rem;
        justify-content: center;
    }
    
    .upload-content h3 {
        font-size: 1.1rem;
    }
    
    .upload-content p {
        font-size: 0.8rem;
    }
    
    .control-panel {
        padding: 0.5rem;
    }
    
    .control-group {
        gap: 0.25rem;
    }
    
    .canvas-container {
        height: 50vh;
        min-height: 250px;
    }
    
    .info-panel {
        padding: 0.5rem;
    }
    
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
        min-height: 36px;
    }
    
    .btn-icon {
        padding: 0.5rem;
        min-width: 36px;
    }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .canvas-container {
        height: 80vh;
        min-height: 200px;
    }
    
    .control-panel {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        padding: 0.5rem 1rem;
    }
    
    .control-group {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.5rem;
    }
    
    .info-panel {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        padding: 0.5rem 1rem;
    }
}

/* 竖屏模式特殊处理 */
@media (max-width: 768px) and (orientation: portrait) {
    .canvas-container {
        height: 50vh;
        min-height: 300px;
    }
    
    .control-panel .control-group:nth-child(2) {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .btn-icon {
        margin: 0.125rem;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
        color: #f7fafc;
    }
    
    .header {
        background: rgba(26, 32, 44, 0.95);
        border-bottom-color: rgba(74, 85, 104, 0.8);
    }
    
    .upload-area {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .upload-area:hover {
        background: #374151;
    }
    
    .viewer-container {
        background: #2d3748;
    }
    
    .control-panel,
    .info-panel {
        background: #374151;
        border-color: #4a5568;
    }
    
    .modal-content {
        background: #2d3748;
        color: #e2e8f0;
    }
}

/* Fullscreen styles */
.fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.fullscreen .canvas-container {
    height: 100vh !important;
    width: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
}

.fullscreen .control-panel {
    position: absolute !important;
    top: 20px !important;
    left: 20px !important;
    right: 20px !important;
    background: rgba(248, 250, 252, 0.9) !important;
    backdrop-filter: blur(10px) !important;
    border-radius: 0.75rem !important;
    z-index: 10000 !important;
    transition: opacity 0.3s ease, transform 0.3s ease !important;
}

.fullscreen .info-panel {
    position: absolute !important;
    bottom: 20px !important;
    left: 20px !important;
    right: 20px !important;
    background: rgba(248, 250, 252, 0.9) !important;
    backdrop-filter: blur(10px) !important;
    border-radius: 0.75rem !important;
    z-index: 10000 !important;
    transition: opacity 0.3s ease, transform 0.3s ease !important;
}

.fullscreen .control-panel.hidden {
    opacity: 0 !important;
    transform: translateY(-100%) !important;
    pointer-events: none !important;
}

.fullscreen .info-panel.hidden {
    opacity: 0 !important;
    transform: translateY(100%) !important;
    pointer-events: none !important;
}

/* 全屏模式下显示切换按钮 */
.fullscreen #togglePanelsBtn {
    display: inline-flex !important;
}

/* Button hover effects */
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}

/* Animation for smooth transitions */
.canvas-container,
.viewer-container {
    transition: all 0.3s ease;
}

/* Image List Modal */
.image-list-modal {
    max-width: 800px;
    max-height: 90vh;
}

.image-list-container {
    max-height: 70vh;
    overflow-y: auto;
}

.image-list-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.image-item {
    position: relative;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    transition: all 0.2s ease;
    cursor: pointer;
}

.image-item:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.image-item.active {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.image-preview {
    width: 100%;
    height: 120px;
    object-fit: cover;
    background: #e2e8f0;
}

.image-info {
    padding: 0.75rem;
}

.image-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-size {
    font-size: 0.75rem;
    color: #6b7280;
}

.image-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.image-item:hover .image-actions {
    opacity: 1;
}

.image-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.image-action-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

.image-action-btn [data-feather] {
    width: 14px;
    height: 14px;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

.empty-state [data-feather] {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    color: #9ca3af;
}

.empty-state p {
    margin-bottom: 0.5rem;
}

.sub-text {
    font-size: 0.875rem;
    color: #9ca3af !important;
}

/* Privacy Modal */
.privacy-content {
    max-height: 60vh;
    overflow-y: auto;
}

.privacy-section {
    margin-bottom: 1.5rem;
}

.privacy-section:last-child {
    margin-bottom: 0;
}

.privacy-section h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.privacy-section h4 [data-feather] {
    width: 20px;
    height: 20px;
    color: #3b82f6;
}

.privacy-section p {
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.privacy-section ul {
    list-style: none;
    padding-left: 0;
}

.privacy-section li {
    padding: 0.25rem 0;
    color: #6b7280;
    position: relative;
    padding-left: 1.5rem;
    line-height: 1.5;
}

.privacy-section li::before {
    content: '✓';
    color: #059669;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* VR Mode Styles */
.vr-mode-active {
    cursor: crosshair;
}

.vr-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 1000;
}

/* Mobile VR optimizations */
@media (max-width: 768px) {
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }
    
    .image-preview {
        height: 100px;
    }
    
    .image-info {
        padding: 0.5rem;
    }
    
    .image-list-modal {
        max-width: 95vw;
    }
    
    .image-list-header {
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* 防止按钮事件冲突 */
#selectFileBtn {
    position: relative;
    z-index: 10;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .upload-area {
        cursor: pointer;
    }
    
    .btn {
        -webkit-tap-highlight-color: transparent;
        -webkit-user-select: none;
        user-select: none;
    }
}

/* Feather icons styling */
[data-feather] {
    width: 18px;
    height: 18px;
}

.logo [data-feather] {
    width: 24px;
    height: 24px;
}

.upload-icon [data-feather] {
    width: 48px;
    height: 48px;
} 

.history-privacy {
    margin-top: 1rem;
    font-size: 0.75rem;
    color: #6b7280;
    text-align: center;
} 

.dropdown {
    position: relative;
    display: inline-block;
}
.dropdown-menu {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 100%; /* Make dropdown menu full width on mobile */
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.1);
    z-index: 100;
    border-radius: 0.75rem;
    padding: 0.5rem 0;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    border: 1px solid #e2e8f0;
}
.dropdown-menu a {
    color: #374151;
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    display: block;
    font-size: 0.875rem;
    transition: background-color 0.2s ease;
}
.dropdown-menu a:hover {
    background-color: #f8fafc;
}
.dropdown:hover .dropdown-menu {
    display: block;
    opacity: 1;
    transform: translateY(0);
}
.dropdown-toggle::after {
    display: inline-block;
    margin-left: .5em;
    vertical-align: .255em;
    content: "";
    border-top: .4em solid;
    border-right: .4em solid transparent;
    border-bottom: 0;
    border-left: .4em solid transparent;
} 

.powered-by {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: #6b7280;
}
.powered-by a {
    color: #2563eb;
    text-decoration: none;
}
.powered-by a:hover {
    text-decoration: underline;
} 

footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    color: #6b7280;
    width: 100%;
    background: transparent;
}
footer a {
    color: #2563eb;
    text-decoration: none;
}
footer a:hover {
    text-decoration: underline;
} 

#transitionSwitch.active {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: none;
}

.control-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
} 

.alert-modal {
    max-width: 400px;
    border: 1px solid #fca5a5; /* Red border */
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.1); /* Red shadow */
}

.alert-modal .modal-header {
    background-color: #fef2f2; /* Light red background */
}

.alert-modal .modal-header h3 {
    color: #b91c1c; /* Dark red text */
}

.alert-modal .modal-body p {
    font-size: 1rem;
    color: #4b5563;
    line-height: 1.6;
} 