/* === Encoder/Decoder Specific Styles === */

.tool-header {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.ed-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background-color: var(--surface-bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
}

.ed-control-group {
    display: flex;
    align-items: center;
    /* This will vertically center the label and the container */
    gap: var(--spacing-sm);
}

.ed-format-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center the select box within its container */
}

.ed-format-warning {
    font-size: 0.85rem;
    color: var(--warning-color);
    font-weight: 500;
    white-space: nowrap;
    margin-top: 4px;
    height: 0;
    /* Collapse when empty */
    opacity: 0;
    /* Hide when empty */
    transition: height 0.2s ease-out, opacity 0.2s ease-out;
}

.ed-format-warning.show {
    height: 1.2em;
    /* Animate to its natural height */
    opacity: 1;
}

.ed-control-group label {
    margin-bottom: 0;
}

.ed-action-buttons {
    display: flex;
    align-items: center;
    /* Align with the format group */
    gap: var(--spacing-sm);
    /* Ensure it has enough height to match the format group */
    min-height: 40px;
    /* Adjust as needed */
}

.ed-main-layout {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: var(--spacing-sm);
}

.ed-io-panel {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    min-width: 0;
    position: relative;
}

.ed-textarea {
    min-height: 200px;
    resize: vertical;
    font-family: var(--font-family-monospace);
    font-size: 1rem;
    background-color: var(--bg-deep-dark);
    flex-grow: 1;
    padding-bottom: 40px;
}

.ed-textarea:read-only {
    background-color: var(--surface-bg-color);
    cursor: default;
}

.ed-textarea.warning {
    color: var(--warning-color);
    font-weight: 500;
}

.ed-swap-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-md);
    height: 100%;
}

/* Set a fixed size for swap and clear buttons for consistency. */
#ed-swap-btn,
#ed-clear-btn {
    width: 70px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#ed-swap-btn {
    font-size: 1.3rem;
    line-height: 1;
    /* Prevents larger font from affecting button height. */
}

.ed-copy-wrapper {
    position: absolute;
    bottom: var(--spacing-sm);
    left: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.btn-copy,
.btn-paste {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.875rem;
    background-color: rgba(0, 0, 0, 0.3);
    border-color: var(--border-color);
    color: var(--text-secondary-color);
}

.btn-copy:hover,
.btn-paste:hover {
    background-color: var(--accent-color);
    color: var(--text-on-accent-bg);
}

.ed-copy-feedback {
    color: var(--success-color);
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    pointer-events: none;
}

.ed-copy-feedback.show {
    opacity: 1;
}

.ed-error-message {
    color: var(--error-color);
    font-weight: 600;
    font-size: 0.9rem;
    display: block;
    min-height: 1.2em;
    text-align: center;
    margin-top: var(--spacing-md);
}

@media (max-width: 768px) {
    .ed-main-layout {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .ed-swap-container {
        flex-direction: row;
        transform: none;
        min-height: auto;
        margin: 0 auto;
    }

    .ed-controls {
        flex-direction: column;
        gap: var(--spacing-md);
        align-items: center;
    }
}