
* {
    box-sizing: border-box;
}

:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --border: #e5e7eb;
    --text: #111827;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --dark: #111827;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family:
        Arial,
        Helvetica,
        sans-serif;
}

.container {
    width: min(1200px, calc(100% - 30px));
    margin: 35px auto;
}

.card {
    background: var(--card);
    border-radius: 18px;
    padding: 30px;
    box-shadow: 0 12px 45px rgba(0, 0, 0, .07);
}

h1 {
    text-align: center;
    margin: 0;
    font-size: 32px;
}

.subtitle {
    max-width: 850px;
    margin: 12px auto 30px;
    text-align: center;
    color: var(--muted);
    line-height: 1.6;
}

/* Upload */

.upload-area {
    display: block;
    padding: 45px 20px;
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    background: #fafbfc;
    text-align: center;
    cursor: pointer;
    transition: .2s;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: #eff6ff;
}

.upload-icon {
    font-size: 52px;
    margin-bottom: 12px;
}

.upload-area h2 {
    margin: 0 0 8px;
    font-size: 21px;
}

.upload-area p {
    margin: 0;
    color: var(--muted);
}

#zipInput {
    display: none;
}

/* Buttons */

.actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

button {
    border: 0;
    border-radius: 9px;
    padding: 11px 17px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: .2s;
}

button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

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

.primary-btn:hover:not(:disabled) {
    background: var(--primary-dark);
}

.secondary-btn {
    background: #e5e7eb;
    color: #111827;
}

.secondary-btn:hover:not(:disabled) {
    background: #d1d5db;
}

.green-btn {
    background: var(--success);
    color: white;
}

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

.danger-btn {
    background: #fee2e2;
    color: #991b1b;
}

.small-btn {
    padding: 7px 10px;
    font-size: 12px;
}

/* Status */

.status {
    display: none;
    margin-top: 18px;
    padding: 13px 15px;
    border-radius: 10px;
    text-align: center;
    font-size: 14px;
}

.status.info {
    display: block;
    background: #eff6ff;
    color: #1d4ed8;
}

.status.success {
    display: block;
    background: #f0fdf4;
    color: #15803d;
}

.status.error {
    display: block;
    background: #fef2f2;
    color: #dc2626;
}

/* Summary */

.summary {
    display: none;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-top: 25px;
}

.summary-card {
    padding: 17px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    text-align: center;
}

.summary-value {
    font-size: 21px;
    font-weight: 700;
    color: var(--primary);
    word-break: break-word;
}

.summary-label {
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
}

/* Sections */

.section {
    display: none;
    margin-top: 30px;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.section-title h2 {
    margin: 0;
    font-size: 21px;
}

/* Archive info */

.archive-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.info-row {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 13px;
    background: #fafafa;
}

.info-label {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 5px;
}

.info-value {
    font-size: 13px;
    font-weight: 600;
    word-break: break-word;
}

.hash {
    font-family: Consolas, monospace;
    font-size: 11px;
}

/* Custom fields */

.custom-fields {
    margin-top: 15px;
}

.custom-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
    margin-bottom: 8px;
}

input[type="text"] {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 11px;
    font-size: 13px;
    outline: none;
}

input[type="text"]:focus {
    border-color: var(--primary);
}

/* Search */

.search-box {
    margin-bottom: 12px;
}

.search-box input {
    width: 100%;
}

/* Tree */

.tree-wrapper {
    border: 1px solid var(--border);
    border-radius: 13px;
    overflow: hidden;
    background: #fafbfc;
}

.tree {
    max-height: 550px;
    overflow: auto;
    padding: 10px;
}

.tree ul {
    list-style: none;
    margin: 0;
    padding-left: 22px;
}

.tree > ul {
    padding-left: 0;
}

.tree-node {
    margin: 2px 0;
}

.tree-row {
    min-height: 39px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 7px;
    border-radius: 7px;
}

.tree-row:hover {
    background: #eef2ff;
}

.tree-toggle {
    width: 23px;
    height: 23px;
    padding: 0;
    background: transparent;
    color: #4b5563;
}

.tree-toggle:hover {
    background: #e5e7eb;
}

.tree-icon {
    width: 23px;
    text-align: center;
    flex: 0 0 23px;
}

.tree-name {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 13px;
}

.tree-meta {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

/* Table */

.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
}

table {
    width: 100%;
    min-width: 1150px;
    border-collapse: collapse;
}

thead {
    background: #f8fafc;
}

th,
td {
    padding: 11px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    vertical-align: middle;
}

th {
    color: #374151;
    white-space: nowrap;
}

td {
    color: #4b5563;
}

tbody tr:hover {
    background: #fafafa;
}

.file-name {
    font-weight: 600;
    color: #111827;
}

.file-path {
    color: var(--muted);
    font-size: 10px;
    margin-top: 3px;
    max-width: 280px;
    overflow-wrap: anywhere;
}

.mono {
    font-family: Consolas, Monaco, monospace;
    font-size: 10px;
}

/* Tabs */

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.tab-btn {
    background: #e5e7eb;
    color: #374151;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

/* Preview */

.preview {
    width: 100%;
    min-height: 390px;
    max-height: 650px;
    overflow: auto;
    padding: 18px;
    border-radius: 12px;
    background: #111827;
    color: #e5e7eb;
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
    line-height: 1.65;
    white-space: pre;
}

/* Download */

.download-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.download-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    background: #fafafa;
}

.download-card h3 {
    margin: 0 0 6px;
    font-size: 15px;
}

.download-card p {
    color: var(--muted);
    font-size: 11px;
    min-height: 34px;
}

/* File detail modal */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: 1000;
    padding: 20px;
    align-items: center;
    justify-content: center;
}

.modal-box {
    width: min(700px, 100%);
    max-height: 85vh;
    overflow: auto;
    background: white;
    border-radius: 16px;
    padding: 24px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.detail-item {
    padding: 11px;
    background: #f8fafc;
    border-radius: 8px;
}

.detail-label {
    color: var(--muted);
    font-size: 10px;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 12px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

/* Footer */

.info {
    margin-top: 28px;
    padding: 18px;
    border-radius: 12px;
    background: #f8fafc;
    color: #4b5563;
    font-size: 13px;
    line-height: 1.7;
}

.info strong {
    color: #111827;
}

.footer {
    text-align: center;
    color: #9ca3af;
    font-size: 12px;
    margin-top: 20px;
}

/* Responsive */

@media (max-width: 950px) {
    .summary {
        grid-template-columns: repeat(3, 1fr);
    }

    .download-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 700px) {
    .container {
        width: calc(100% - 18px);
        margin: 15px auto;
    }

    .card {
        padding: 20px 14px;
    }

    h1 {
        font-size: 27px;
    }

    .summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .archive-info {
        grid-template-columns: 1fr;
    }

    .custom-field-row {
        grid-template-columns: 1fr;
    }

    .download-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}
