:root {
    --bg-main: #111114;
    --bg-card: #1b1b22;
    --bg-card-header: #21212a;
    --bg-input: #141419;
    --bg-dropzone: #16161c;
    --bg-dropzone-hover: #1e2436;
    
    --border-color: #2b2b36;
    --border-highlight: #3b82f6;
    
    --text-main: #f1f1f4;
    --text-muted: #9ba1b0;
    --text-dim: #6b7280;
    
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-dim: rgba(59, 130, 246, 0.15);
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --info-blue: #38bdf8;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-family);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 24px 16px;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    width: 100%;
    max-width: 820px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.app-logo {
    background: linear-gradient(135deg, #1d4ed8, #3b82f6);
    color: #fff;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

.logo-text {
    font-weight: 900;
    font-size: 16px;
    letter-spacing: 1px;
}

.logo-sub {
    font-size: 9px;
    letter-spacing: 2px;
    font-weight: 700;
    opacity: 0.85;
}

.title-with-badge {
    display: flex;
    align-items: center;
    gap: 8px;
}

.title-group h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.version-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.2);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(59, 130, 246, 0.35);
}

.edition-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-dim);
    padding: 2px 8px;
    border-radius: 999px;
    margin-top: 2px;
}

.header-right .gh-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    transition: all 0.2s ease;
}

.header-right .gh-link:hover {
    color: var(--text-main);
    border-color: var(--text-muted);
    background: var(--bg-card-header);
}

/* Nav Tabs */
.nav-tabs {
    display: flex;
    gap: 8px;
    background: var(--bg-card);
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow-x: auto;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

/* Tab Content */
.tab-content {
    display: none;
    flex-direction: column;
    gap: 16px;
}

.tab-content.active {
    display: flex;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-sm);
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 14px;
    letter-spacing: -0.2px;
}

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.card-header-flex .card-title {
    margin-bottom: 0;
}

/* Form Controls */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    font-size: 13px;
    color: var(--text-main);
}

.dim {
    color: var(--text-dim);
    font-weight: normal;
}

.help-text {
    font-size: 12px;
    color: var(--text-muted);
}

.text-input, .textarea-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s ease;
}

.text-input:focus, .textarea-input:focus {
    border-color: var(--border-highlight);
}

.label-with-counter {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.char-counter {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.radio-label, .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-main);
    cursor: pointer;
}

/* Dropzones */
.dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-dropzone);
    padding: 16px;
    text-align: center;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--border-highlight);
    background: var(--bg-dropzone-hover);
}

.file-input-hidden {
    display: none;
}

.dropzone-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.dropzone-icon {
    font-size: 24px;
}

.dropzone-text {
    font-size: 13px;
    color: var(--text-muted);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.btn-link:hover {
    color: var(--primary-hover);
}

.dropzone-selected {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-input);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.file-icon {
    font-size: 20px;
}

.file-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    text-align: left;
    overflow: hidden;
}

.file-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-mono);
}

.file-size {
    font-size: 11px;
    color: var(--text-muted);
}

.btn-clear {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
}

.btn-clear:hover {
    color: var(--danger);
    background: var(--danger-bg);
}

/* Details Grid */
.placeholder-box {
    padding: 20px;
    text-align: center;
    font-size: 13px;
    color: var(--text-dim);
    font-style: italic;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border-color);
}

.details-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-input);
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.grid-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}

.grid-label {
    color: var(--text-muted);
    font-weight: 500;
}

.grid-value {
    color: var(--text-main);
    font-weight: 600;
    text-align: right;
}

.font-italic {
    font-style: italic;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.badge-blue {
    background: rgba(56, 189, 248, 0.15);
    color: var(--info-blue);
}

.badge-green {
    background: var(--success-bg);
    color: var(--success);
}

.badge-yellow {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-red {
    background: var(--danger-bg);
    color: var(--danger);
}

/* Action Buttons */
.actions-container {
    display: flex;
    gap: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    flex: 1;
}

.btn-primary:not(:disabled):hover {
    background: var(--primary-hover);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: var(--bg-card-header);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:not(:disabled):hover {
    background: #2a2a36;
    border-color: var(--text-muted);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.btn-small:hover {
    color: var(--text-main);
    border-color: var(--text-muted);
}

/* Progress Box */
.progress-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
}

.progress-percent {
    color: var(--primary);
    font-family: var(--font-mono);
}

.progress-track {
    height: 8px;
    background: var(--bg-input);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 999px;
    transition: width 0.1s ease;
}

.progress-detail {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Status Banner */
.status-banner {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.status-banner.success {
    background: var(--success-bg);
    border: 1px solid var(--success);
    color: #34d399;
}

.status-banner.error {
    background: var(--danger-bg);
    border: 1px solid var(--danger);
    color: #f87171;
}

/* DIZ Viewer */
.diz-viewer {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: #bae6fd;
    max-height: 240px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Accordion */
.accordion {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.accordion-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    overflow: hidden;
}

.accordion-header {
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    color: var(--text-main);
    background: var(--bg-card);
}

.accordion-header:hover {
    color: var(--primary);
}

.accordion-body {
    padding: 14px;
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

.guide-list {
    margin-left: 20px;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.guide-list strong {
    color: var(--text-main);
}

.trouble-item {
    margin-bottom: 12px;
}

.trouble-item:last-child {
    margin-bottom: 0;
}

.trouble-item p {
    margin-top: 4px;
}

.intro-text {
    font-size: 14px;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 16px;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 16px;
    font-size: 12px;
    color: var(--text-dim);
}

.app-footer a {
    color: var(--text-muted);
    text-decoration: none;
}

.app-footer a:hover {
    color: var(--text-main);
    text-decoration: underline;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
    .nav-tabs {
        justify-content: flex-start;
    }
    .actions-container {
        flex-direction: column;
    }
    .grid-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
}
