:root {
    --bg-app: #030712;
    --bg-panel: #111827;
    --bg-input: #1f2937;
    --border-color: #374151;
    --border-focus: #6366f1;

    --text-main: #f9fafb;
    --text-muted: #9ca3af;

    --c-primary: #6366f1;
    --c-primary-hover: #4f46e5;
    --c-danger: #ef4444;
    --c-warn: #eab308;
    --c-success: #10b981;
    --c-success-hover: #059669;

    --font-ui: 'Outfit', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    font-family: var(--font-ui);
    background-color: var(--bg-app);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Base Layout */
.app-container {
    width: 100%;
    max-width: 1000px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Header & Tabs */
.header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--c-primary);
}

.brand h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-main);
}

.tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.25rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    background: var(--bg-input);
    color: var(--text-main);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Workspace */
.workspace {
    padding: 2rem;
    min-height: 500px;
}

.pane.hidden {
    display: none;
}

/* Buttons */
.btn {
    font-family: var(--font-ui);
    cursor: pointer;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

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

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

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

.btn-secondary:hover {
    background: #374151;
}

.btn-success {
    background: var(--c-success);
    color: #fff;
}

.btn-success:hover {
    background: var(--c-success-hover);
}

.btn-lg {
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
}

.btn-sm {
    font-size: 0.8rem;
    padding: 0.4rem 0.75rem;
}

.btn-icon {
    background: transparent;
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 4px;
    display: flex;
}

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

/* Alerts */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 1.5rem;
}

.alert-warning {
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.2);
    color: #fef08a;
}

.alert-warning svg {
    color: var(--c-warn);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fecaca;
}

.alert-error svg {
    color: var(--c-danger);
}


/* ENCODE PANE */
.drop-zone {
    border: 3px dashed var(--border-color);
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.2);
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--c-primary);
    background: rgba(99, 102, 241, 0.05);
}

.drop-content {
    text-align: center;
    pointer-events: none;
}

.drop-icon {
    color: var(--c-primary);
    margin-bottom: 1rem;
    transition: transform 0.3s;
}

.drop-zone.dragover .drop-icon {
    transform: translateY(-10px);
}

.drop-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.drop-content p {
    color: var(--text-muted);
    font-size: 1rem;
}

.drop-content .file-hints {
    margin-top: 1.5rem;
    font-size: 0.85rem;
    opacity: 0.7;
}

/* Encode Results */
.results-container {
    animation: fadeIn 0.4s ease-out;
}

.file-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.meta-info h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    word-break: break-all;
}

.meta-info span {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.preview-box {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    min-height: 100px;
}

.preview-box img {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 4px;
}

.export-cards {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.export-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
}

.card-header h4 {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.code-output {
    width: 100%;
    height: 100px;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 1rem;
    resize: vertical;
    outline: none;
    line-height: 1.5;
    word-break: break-all;
}


/* DECODE PANE */
.decode-workspace {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.decode-input-area {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

#input-base64 {
    width: 100%;
    height: 200px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 1rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

#input-base64:focus {
    border-color: var(--border-focus);
}

.decode-actions {
    display: flex;
    gap: 1rem;
}

.decode-results {
    animation: fadeIn 0.4s ease-out;
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
}

.decode-meta {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.meta-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.meta-value {
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

.download-action {
    display: flex;
    justify-content: flex-start;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #fff;
    color: #000;
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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