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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

/* Page Header with Links */
.page-header {
    max-width: 1200px;
    margin: 0 auto 20px;
    padding: 0 20px;
}

.header-links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.header-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: white;
    text-decoration: underline;
    text-underline-offset: 4px;
    font-size: 0.95em;
    transition: all 0.3s ease;
}

.header-link:hover {
    color: rgba(255, 255, 255, 0.8);
    text-decoration-thickness: 2px;
}

.header-link svg {
    flex-shrink: 0;
    opacity: 0.9;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

h1 {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1.1em;
}

/* Top Bar with Image */
.top-bar {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin: 20px 0;
    min-height: 60px;
}

/* Upload Button - In Header */
.upload-button-container {
    margin: 0;
}

.upload-button {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #667eea;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.9em;
}

.upload-button:hover {
    background: #764ba2;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.upload-button.dragover {
    background: #764ba2;
    transform: scale(1.05);
}

.upload-icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.upload-button-text {
    font-size: 0.85em;
}

.results-section {
    margin-top: 40px;
}

/* File Header with Name */
.file-header {
    text-align: center;
    margin-bottom: 40px;
}

.file-name {
    font-size: 2em;
    color: #667eea;
    margin-bottom: 20px;
    word-break: break-word;
}

/* First Image - Tiny in Upper Left */
.first-image-container {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    background: #f8f9ff;
    padding: 4px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.first-image-container:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.first-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.file-info {
    background: #f8f9ff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.file-info h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.file-info-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.file-info-item:last-child {
    border-bottom: none;
}

.file-info-label {
    font-weight: 600;
    color: #555;
}

.file-info-value {
    color: #333;
}

.parsed-content h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-button {
    padding: 12px 24px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1em;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tab-button:hover {
    color: #667eea;
    background: #f8f9ff;
}

.tab-button.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    position: relative;
}

.tab-pane {
    display: none;
    padding: 20px;
    background: #fafafa;
    border-radius: 8px;
    max-height: 600px;
    overflow-y: auto;
}

.tab-pane.active {
    display: block;
}

.property-group {
    margin-bottom: 25px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.property-group-title {
    font-size: 1.2em;
    color: #667eea;
    margin-bottom: 15px;
    font-weight: 600;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

.property-item {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.property-item:last-child {
    border-bottom: none;
}

.property-key {
    font-weight: 600;
    color: #555;
    word-break: break-word;
}

.property-value {
    color: #333;
    word-break: break-word;
    font-family: 'Courier New', monospace;
    background: #f8f9ff;
    padding: 8px 12px;
    border-radius: 4px;
}

.formatted-content {
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    line-height: 1.6;
    color: #333;
}

.raw-content {
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    line-height: 1.6;
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    border-left: 4px solid #c33;
}

.section-title {
    font-size: 1.1em;
    color: #667eea;
    margin-top: 20px;
    margin-bottom: 10px;
    font-weight: 600;
}

/* Scrollbar styling */
.tab-pane::-webkit-scrollbar {
    width: 8px;
}

.tab-pane::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.tab-pane::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.tab-pane::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* Image Gallery Styles */
.images-header {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9ff;
    border-radius: 8px;
}

.images-header p {
    margin: 0;
    color: #667eea;
    font-weight: 500;
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.image-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.image-container {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.gallery-image:hover {
    transform: scale(1.05);
}

.image-info {
    padding: 12px;
}

.image-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    word-break: break-all;
    font-size: 0.9em;
}

.image-size {
    color: #999;
    font-size: 0.85em;
}

/* Image Modal Styles */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.image-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: zoomIn 0.2s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.9);
    }
    to {
        transform: scale(1);
    }
}

.image-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 40px;
    font-weight: 300;
    cursor: pointer;
    line-height: 1;
    transition: opacity 0.2s ease;
    z-index: 10001;
}

.image-modal-close:hover {
    opacity: 0.7;
}

.image-modal-img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
}

.image-modal-caption {
    color: white;
    margin-top: 15px;
    text-align: center;
    font-size: 0.9em;
    opacity: 0.9;
    word-break: break-all;
    max-width: 90%;
}

