/* ============================================
   HEIC/HEIF Viewer & Analyzer - Modern Stylesheet
   Purple/Magenta Color Theme for ConvertICO
   ============================================ */

/* CSS Variables */
:root {
    --primary: #9333EA;
    --primary-light: #F3E8FF;
    --primary-dark: #7C3AED;
    --accent: #A855F7;
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    
    --quality: #9333EA;
    --codec: #A855F7;
    --exif: #C084FC;
    --metadata: #D946EF;
    
    --bg: #f8fafc;
    --bg-elevated: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg) 0%, #f1f5f9 100%);
    color: var(--text);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

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

/* Header */
.tool-header { text-align: center; margin-bottom: 2rem; }

.tool-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.tool-icon-wrapper {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow-lg), 0 0 40px rgba(147, 51, 234, 0.25);
    flex-shrink: 0;
}

.tool-icon-wrapper svg { width: 28px; height: 28px; }

.tool-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tool-description {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 650px;
    margin: 0 auto;
    line-height: 1.7;
}

/* Main Tool Area */
.tool-main {
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
}

/* Upload Section */
.upload-section { padding: 3rem; position: relative; }
.upload-form { width: 100%; }

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.05), rgba(124, 58, 237, 0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.upload-area:hover::before,
.upload-area.dragover::before { opacity: 1; }

.upload-content { position: relative; z-index: 1; }

.upload-icon {
    color: var(--primary);
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease;
}

.upload-area:hover .upload-icon { transform: translateY(-5px); }

.upload-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 0.5rem;
}

.upload-subtitle {
    color: var(--text-secondary);
    margin: 0 0 1rem;
    font-size: 1rem;
}

.upload-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
}

/* Processing Overlay */
.processing-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.processing-content { text-align: center; padding: 3rem; }
.processing-spinner { margin-bottom: 1.5rem; color: var(--primary); }
.processing-spinner .spin { animation: spin 1s linear infinite; }

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

.processing-status {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

/* File Info Bar */
.file-info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 1.25rem 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid var(--border);
}

.file-info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.file-info-item svg { color: var(--primary); flex-shrink: 0; }

/* Analysis Grid */
.analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.preview-panel,
.analysis-panel { padding: 2rem; }

.preview-panel {
    background: #fafafa;
    border-right: 1px solid var(--border);
}

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

.panel-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.panel-header h3 svg { color: var(--primary); }

/* Image Display */
.image-display {
    background-color: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    overflow: auto;
    transition: background 0.3s ease;
    position: relative;
    cursor: pointer;
}

/* Hover overlay with expand icon */
.image-display::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(147, 51, 234, 0);
    transition: all 0.3s ease;
    pointer-events: none;
    border-radius: var(--radius-md);
    z-index: 5;
}

.image-display::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 60px;
    height: 60px;
    background: rgba(147, 51, 234, 0.9);
    border-radius: 50%;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 6;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 3 21 3 21 9'%3E%3C/polyline%3E%3Cpolyline points='9 21 3 21 3 15'%3E%3C/polyline%3E%3Cline x1='21' y1='3' x2='14' y2='10'%3E%3C/line%3E%3Cline x1='3' y1='21' x2='10' y2='14'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 28px;
}

.image-display:hover::before { 
    background: rgba(147, 51, 234, 0.08);
}

.image-display:hover::after { 
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.image-display img {
    max-width: 100%;
    max-height: 300px;
    transition: transform 0.3s ease;
    border-radius: var(--radius-sm);
    position: relative;
    z-index: 1;
}

/* Click hint below image */
.click-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.image-display:hover .click-hint {
    opacity: 1;
}

.image-display.checkerboard-bg {
    background-image: linear-gradient(45deg, #e0e0e0 25%, transparent 25%), 
                      linear-gradient(-45deg, #e0e0e0 25%, transparent 25%), 
                      linear-gradient(45deg, transparent 75%, #e0e0e0 75%), 
                      linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.preview-unavailable {
    color: var(--text-muted);
    font-style: italic;
    padding: 2rem;
    text-align: center;
}

.preview-unavailable svg {
    display: block;
    margin: 0 auto 1rem;
    opacity: 0.5;
}

/* Fullscreen Lightbox */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(10px);
}

.lightbox-overlay.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.lightbox-info {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.lightbox-controls {
    position: absolute;
    bottom: -50px;
    right: 0;
    display: flex;
    gap: 0.5rem;
}

.lightbox-ctrl-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.lightbox-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-kbd {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: monospace;
}

/* Background Toggle */
.bg-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--border);
    transition: 0.3s;
    border-radius: var(--radius-full);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

input:checked + .toggle-slider:before { transform: translateX(20px); }

/* Viewer Controls */
.viewer-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.control-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.875rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
}

.control-button:hover {
    background: var(--bg-elevated);
    border-color: var(--primary);
    color: var(--primary);
}

.control-button svg { flex-shrink: 0; }

.control-button.fullscreen-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-color: transparent;
    padding: 0.625rem 1.25rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(147, 51, 234, 0.25);
}

.control-button.fullscreen-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(147, 51, 234, 0.35);
}

.control-button.fullscreen-btn svg {
    animation: pulse-subtle 2s ease-in-out infinite;
}

@keyframes pulse-subtle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.control-button.download-btn {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    border-color: transparent;
}

.control-button.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Quality Score Card */
.quality-score-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
}

.quality-score-card.score-high {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.quality-score-card.score-medium {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.05));
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.quality-score-card.score-low {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.05));
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.score-ring {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.score-high .score-ring {
    background: linear-gradient(135deg, var(--success), #059669);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.score-medium .score-ring {
    background: linear-gradient(135deg, var(--warning), #D97706);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.score-low .score-ring {
    background: linear-gradient(135deg, var(--danger), #DC2626);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.score-ring .score-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
}

.score-details { display: flex; flex-direction: column; }

.score-details .score-label {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

.score-details .score-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.stat-card.highlight-apple {
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.08), rgba(168, 85, 247, 0.04));
    border-color: rgba(147, 51, 234, 0.2);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    flex-shrink: 0;
}

.stat-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Accordion Sections */
.accordion-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.accordion-trigger {
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--bg);
    border: none;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.accordion-trigger:hover { background: var(--bg-elevated); }

.accordion-trigger span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.accordion-trigger span svg { color: var(--primary); }

.accordion-icon {
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.accordion-section.open .accordion-icon { transform: rotate(180deg); }

.accordion-content {
    display: none;
    padding: 0 1.25rem 1.25rem;
    background: var(--bg-elevated);
}

.accordion-section.open .accordion-content { display: block; }

/* Details List */
.details-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0.875rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.detail-name {
    font-weight: 500;
    color: var(--text-secondary);
}

.detail-value {
    font-weight: 600;
    color: var(--text);
}

.detail-value.has-feature { color: var(--success); }
.detail-value.has-metadata { color: var(--warning); }

.detail-value.apple-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--primary);
}

/* EXIF Grid */
.exif-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.exif-item {
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.exif-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.25rem;
}

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

/* Thumbnail Section */
.thumbnail-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.thumbnail-section h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.thumbnail-section h4 svg { color: var(--primary); }

.thumbnail-preview {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--border);
}

.thumbnail-preview img {
    max-width: 100%;
    max-height: 120px;
    border-radius: var(--radius-sm);
}

.thumbnail-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Codec Badge */
.codec-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    background: linear-gradient(135deg, var(--primary-light), #ede9fe);
    color: var(--primary-dark);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

/* Recommendations Section */
.recommendations-section {
    padding: 2rem;
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    border-top: 1px solid var(--border);
}

.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.recommendation-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
}

.rec-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    flex-shrink: 0;
}

/* Recommended Tools */
.recommended-tools h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 1rem;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.tool-card-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
}

.tool-card-link:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.tool-icon-small {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    flex-shrink: 0;
}

.tool-info { display: flex; flex-direction: column; }

.tool-info .tool-name {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
}

.tool-info .tool-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Action Bar */
.action-bar {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-top: 1px solid var(--border);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn svg { flex-shrink: 0; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(147, 51, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(147, 51, 234, 0.4);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--text-muted);
}

/* Error Message */
.error-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 2rem;
    padding: 1rem 1.5rem;
    background: var(--danger-light);
    border: 1px solid #FECACA;
    border-radius: var(--radius-md);
    color: var(--danger);
    font-weight: 500;
}

.error-message svg { flex-shrink: 0; }

/* Related Tools */
.related-tools {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
    padding: 1.25rem 1.5rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.related-label {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
}

.related-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.related-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: var(--bg);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
}

.related-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

.related-link svg { flex-shrink: 0; }

/* Info Sections */
.info-sections {
    display: grid;
    gap: 2rem;
    margin-top: 3rem;
}

.info-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.info-card h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.35rem;
    color: var(--text);
    margin: 0 0 1.5rem;
}

.info-card h2 svg { color: var(--primary); flex-shrink: 0; }

.info-card p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0 0 1rem;
}

.info-card p:last-child { margin-bottom: 0; }

.info-card p a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px dotted var(--primary);
    transition: all 0.2s ease;
}

.info-card p a:hover { border-bottom-style: solid; }

/* Steps List */
.steps-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: step;
}

.steps-list li {
    position: relative;
    padding-left: 3.5rem;
    padding-bottom: 1.25rem;
    counter-increment: step;
    color: var(--text-secondary);
    line-height: 1.6;
}

.steps-list li:not(:last-child)::after {
    content: '';
    position: absolute;
    left: calc(1rem - 1px);
    top: 2rem;
    bottom: 0;
    width: 2px;
    background: var(--primary-light);
}

.steps-list li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 2rem;
    height: 2rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    z-index: 1;
}

/* Mode Explanations */
.mode-explanations { display: grid; gap: 1rem; }

.mode-explain {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.mode-tag {
    flex-shrink: 0;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
}

.mode-tag.quality { background: linear-gradient(135deg, var(--quality), #7C3AED); }
.mode-tag.codec { background: linear-gradient(135deg, var(--codec), #9333EA); }
.mode-tag.exif { background: linear-gradient(135deg, var(--exif), #A855F7); }
.mode-tag.metadata { background: linear-gradient(135deg, var(--metadata), #C026D3); }

.mode-explain p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Use Cases Grid */
.use-cases-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.use-case {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.use-case:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.use-case-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.use-case-content h4 {
    margin: 0 0 0.375rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.use-case-content p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.use-cases-tip {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    border-radius: var(--radius-md);
    border: 1px solid var(--primary);
}

.use-cases-tip svg {
    color: var(--primary);
    flex-shrink: 0;
    margin-top: 2px;
}

.use-cases-tip span {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.use-cases-tip a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.use-cases-tip a:hover { text-decoration: underline; }

/* FAQ */
.faq-list { display: grid; gap: 0.75rem; }

.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--bg);
    border: none;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.faq-question:hover { background: var(--bg-elevated); }

.faq-question svg {
    color: var(--primary);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.faq-item.open .faq-question svg { transform: rotate(180deg); }

.faq-answer {
    display: none;
    padding: 0 1.25rem 1rem;
    background: var(--bg-elevated);
}

.faq-item.open .faq-answer { display: block; }

.faq-answer p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Responsive */
@media (max-width: 900px) {
    .analysis-grid { grid-template-columns: 1fr; }
    .preview-panel { border-right: none; border-bottom: 1px solid var(--border); }
    .file-info-bar { justify-content: center; }
    .tools-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .tool-container { padding: 1rem; }
    .tool-title-row { flex-direction: row; gap: 0.75rem; }
    .tool-icon-wrapper { width: 48px; height: 48px; }
    .tool-icon-wrapper svg { width: 24px; height: 24px; }
    .upload-section { padding: 2rem 1.5rem; }
    .preview-panel, .analysis-panel { padding: 1.5rem; }
    .stats-grid { grid-template-columns: 1fr; }
    .action-bar { flex-direction: column; padding: 1.5rem; }
    .btn { width: 100%; }
    .related-tools { flex-direction: column; text-align: center; }
    .related-links { justify-content: center; }
    .mode-explain { flex-direction: column; }
    .use-cases-grid { grid-template-columns: 1fr; }
    .quality-score-card { flex-direction: column; text-align: center; }
    .exif-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .tool-title { font-size: 1.5rem; }
    .file-info-bar { flex-direction: column; gap: 0.75rem; align-items: flex-start; }
    .steps-list li { padding-left: 3rem; }
    .viewer-controls { flex-direction: column; align-items: stretch; }
    .control-button { justify-content: center; }
}

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

.results-section { animation: fadeIn 0.4s ease; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
