/* --- Base64 Converter Wrapper --- */
#b64-wrapper {
    font-family: 'Press Start 2P', monospace;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    background-color: #111827;
    padding: 30px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    border: 2px solid #374151;
    color: white;
}

/* --- Mode Tabs (Text vs File) --- */
.b64-tabs {
    display: flex;
    width: 100%;
    margin-bottom: 20px;
    border-bottom: 2px solid #374151;
}

.b64-tab {
    flex: 1;
    padding: 15px;
    background: #1f2937;
    color: #9ca3af;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    text-transform: uppercase;
    transition: all 0.2s;
}

.b64-tab:first-child { border-radius: 8px 0 0 0; }
.b64-tab:last-child { border-radius: 0 8px 0 0; }

.b64-tab.active {
    background: #111827;
    color: #00FFFF;
    border-top: 4px solid #00FFFF;
    font-weight: bold;
}

.b64-tab:hover:not(.active) {
    background: #374151;
    color: white;
}

/* --- Control Panel --- */
.b64-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    width: 100%;
    background-color: #1f2937;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    align-items: center;
}

@media (min-width: 600px) {
    .b64-controls {
        grid-template-columns: repeat(3, 1fr);
    }
}

.b64-toggle-group {
    display: flex;
    background: #000;
    border-radius: 4px;
    padding: 4px;
    gap: 4px;
}

.b64-toggle-btn {
    flex: 1;
    background: transparent;
    color: #666;
    border: none;
    padding: 8px;
    font-family: 'Press Start 2P', monospace, sans-serif;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 2px;
}

.b64-toggle-btn.active {
    background: #374151;
    color: white;
}

.b64-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    color: #d1d5db;
    cursor: pointer;
}

.b64-checkbox {
    width: 16px;
    height: 16px;
    accent-color: #00FFFF;
}

/* --- Input/Output Areas --- */
.b64-io-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.b64-pane {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.b64-label {
    font-size: 0.7rem;
    color: #9ca3af;
    text-transform: uppercase;
}

.b64-textarea {
    width: 100%;
    min-height: 200px;
    background-color: #050505;
    color: #d1d5db;
    border: 1px solid #333;
    padding: 15px;
    font-family: 'Press Start 2P', monospace, sans-serif;
    font-size: 0.9rem;
    line-height: 1.5;
    border-radius: 6px;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    white-space: pre-wrap;
    word-break: break-all;
}

.b64-textarea:focus {
    border-color: #00FFFF;
}

.b64-textarea.readonly {
    background-color: #111;
    color: #10b981;
}

/* File Drop Zone */
.b64-dropzone {
    width: 100%;
    height: 150px;
    border: 2px dashed #4b5563;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-family: 'Press Start 2P', monospace, sans-serif;
    font-size: 0.9rem;
    background: #0f0f0f;
    transition: all 0.2s;
    cursor: pointer;
    text-align: center;
    padding: 20px;
}

.b64-dropzone:hover, .b64-dropzone.dragover {
    border-color: #00FFFF;
    background: rgba(0, 255, 255, 0.05);
    color: white;
}

.hidden { display: none !important; }

/* --- Actions --- */
.b64-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    width: 100%;
    margin-top: 20px;
}

.b64-btn {
    padding: 12px 20px;
    font-family: inherit;
    font-size: 0.7rem;
    text-transform: uppercase;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.1s ease;
    border-bottom: 4px solid rgba(0,0,0,0.3);
}

.b64-btn:active {
    transform: translateY(4px);
    border-bottom: none;
    margin-top: 4px;
}

.b64-btn-action { background-color: #00FFFF; color: #000; border-bottom-color: #008B8B; }
.b64-btn-action:hover { background-color: #E0FFFF; }

.b64-btn-copy { background-color: #374151; color: white; border-bottom-color: #1f2937; }
.b64-btn-copy:hover { background-color: #4b5563; }

.b64-btn-download { background-color: #10b981; color: white; border-bottom-color: #047857; }
.b64-btn-download:hover { background-color: #34d399; }

/* Mobile Responsiveness */
@media (max-width: 480px) {
    #b64-wrapper { padding: 15px; }
    .b64-controls { grid-template-columns: 1fr; }
}