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

:root {
    --bg: #0f1115;
    --surface: #181b22;
    --surface-2: #1f232c;
    --border: #2a2f3a;
    --text: #e6e8ec;
    --text-muted: #8a93a3;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
}

header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
}

.upload-section {
    margin-bottom: 2rem;
}

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--surface);
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--accent);
    background: var(--surface-2);
    transform: translateY(-2px);
}

.upload-icon {
    width: 56px;
    height: 56px;
    color: var(--accent);
    margin-bottom: 1rem;
}

.drop-text {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

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

.results {
    animation: fadeIn 0.4s ease;
}

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

.preview-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
}

@media (max-width: 700px) {
    .preview-card {
        grid-template-columns: 1fr;
    }
}

.preview-image-wrapper {
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface-2);
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.preview-info h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    word-break: break-all;
}

.basic-info {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.basic-info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--surface-2);
    border-radius: 8px;
    font-size: 0.9rem;
}

.basic-info-item .label {
    color: var(--text-muted);
}

.basic-info-item .value {
    font-weight: 500;
    text-align: right;
    word-break: break-word;
}

.reset-btn,
.export-btn {
    padding: 0.65rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 0.5rem;
}

.reset-btn {
    background: var(--accent);
    color: white;
}

.reset-btn:hover {
    background: var(--accent-hover);
}

.export-btn {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}

.export-btn:hover {
    background: var(--border);
}

.metadata-report {
    display: grid;
    gap: 1rem;
}

.metadata-group {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.metadata-group-header {
    padding: 1rem 1.25rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.metadata-group-header h3 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.metadata-group-header .count {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 400;
}

.metadata-group-header .chevron {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

.metadata-group.collapsed .chevron {
    transform: rotate(-90deg);
}

.metadata-group.collapsed .metadata-table {
    display: none;
}

.metadata-table {
    width: 100%;
    border-collapse: collapse;
}

.metadata-table tr {
    border-bottom: 1px solid var(--border);
}

.metadata-table tr:last-child {
    border-bottom: none;
}

.metadata-table td {
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
    vertical-align: top;
}

.metadata-table td:first-child {
    color: var(--text-muted);
    width: 40%;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.85rem;
}

.metadata-table td:last-child {
    word-break: break-word;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.85rem;
}

.metadata-table tr:hover {
    background: var(--surface-2);
}

.gps-link {
    color: var(--accent);
    text-decoration: none;
}

.gps-link:hover {
    text-decoration: underline;
}

.empty-msg {
    padding: 1.5rem 1.25rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.error-msg {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    color: #fca5a5;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.hidden {
    display: none !important;
}

footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 3rem;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border);
}

.tag-icon {
    font-size: 1.1rem;
}

.alerts-container {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.alerts-container:empty {
    display: none;
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 0.9rem;
    line-height: 1.45;
}

.alert-icon {
    font-size: 1.15rem;
    flex-shrink: 0;
}

.alert-text code {
    background: var(--surface-2);
    padding: 0.05rem 0.35rem;
    border-radius: 4px;
    font-size: 0.85em;
}

.alert-warn {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.08);
}

.alert-error {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.08);
}

.alert-info {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.08);
}

.color-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid var(--border);
    vertical-align: middle;
    margin-right: 0.4rem;
}

.histogram-wrap {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
}

@media (max-width: 700px) {
    .histogram-wrap {
        grid-template-columns: 1fr;
    }
}

.histogram {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.histogram-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    letter-spacing: 0.05em;
}

.histogram-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 60px;
    background: var(--surface-2);
    padding: 4px;
    border-radius: 6px;
}

.histogram-bar {
    flex: 1;
    min-height: 1px;
    border-radius: 1px;
    opacity: 0.85;
}

.thumbnail-body {
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: center;
    background: var(--surface-2);
}

.embedded-thumbnail {
    max-width: 100%;
    max-height: 300px;
    border-radius: 6px;
    border: 1px solid var(--border);
}
