/* ========================================
   Base64 Encode/Decode — Slate Blue Theme
   ======================================== */
:root {
    --primary: #6366F1;
    --primary-glow: rgba(99, 102, 241, 0.2);
    --bg: #0E1117;
    --bg-card: rgba(14, 17, 23, 0.85);
    --border: rgba(99, 102, 241, 0.12);
    --border-hover: rgba(99, 102, 241, 0.3);
    --text: #E6E8F0;
    --text-secondary: #8B92A8;
    --text-muted: #5C6378;
    --radius: 10px;
    --font: 'Inter', -apple-system, sans-serif;
    --transition: 0.2s ease;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.app {
    max-width: 640px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

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

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
}

.logo-icon {
    font-size: 1.3rem;
}

.logo h1 {
    font-size: 1.15rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #A78BFA);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.tabs {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 0.75rem;
}

.tab {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border);
    background: transparent;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.tab:hover {
    border-color: var(--primary);
}

.tab.active {
    background: rgba(99, 102, 241, 0.12);
    border-color: var(--primary);
    color: var(--text);
}

.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.direction-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.6rem;
}

.dir-btn {
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--border);
    background: transparent;
    border-radius: 100px;
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.dir-btn.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary);
    color: var(--text);
}

.url-safe {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

.url-safe input {
    accent-color: var(--primary);
}

textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(10, 12, 18, 0.7);
    color: var(--text);
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.78rem;
    outline: none;
    resize: vertical;
    margin-bottom: 0.5rem;
}

textarea:focus {
    border-color: var(--primary);
}

textarea[readonly] {
    opacity: 0.85;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
}

.label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--border);
    background: transparent;
    border-radius: 6px;
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

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

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}

.upload-zone:hover {
    border-color: var(--primary);
}

.upload-zone p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.browse {
    color: var(--primary);
    text-decoration: underline;
}

.upload-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.file-output {
    margin-top: 0.75rem;
}

.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 0.55rem 1rem;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 100;
    pointer-events: none;
}

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

.hidden {
    display: none !important;
}

@media (max-width: 480px) {
    .app {
        padding: 1rem 0.85rem 3rem;
    }
}