/* ==========================================================================
   Shared Modal Styles
   Canonical source — all operation modals should use these classes.
   ========================================================================== */

/* Modal container — holds backdrop + dialog as siblings */
.modal-container {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

/* Backdrop */
.modal-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1;
    pointer-events: none;
}

/* Dialog */
.modal-dialog {
    position: relative;
    z-index: 2;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: 12px;
    min-width: min(400px, calc(100vw - 2rem));
    max-width: 480px;
    width: 90vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
}

/* Header */
.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-default);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.modal-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* Body */
.modal-body {
    padding: 1.5rem;
}

/* --- Input mode elements --- */

/* "Доступно: X.XX UNIT" */
.available-amount {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Amount input with suffix */
.amount-field {
    position: relative;
    margin-bottom: 0.75rem;
}

.amount-field input {
    width: 100%;
    padding: 0.75rem 4rem 0.75rem 1rem;
    font-size: 1.25rem;
    font-family: monospace;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    color: var(--text-primary);
}

.amount-field input:focus {
    outline: none;
    border-color: var(--accent);
}

.amount-suffix {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Percentage presets: [10%] [25%] [50%] [75%] */
.presets {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.presets .btn {
    flex: 1;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* "До минимума" / special preset — full-width below percentage row */
.preset-special {
    width: 100%;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
}

/* Amount equivalent (e.g. "≈ $1.62") */
.amount-equivalent {
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-family: monospace;
}

/* Validation error */
.validation-error {
    color: #dc3545;
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}

/* Full-width action button */
.btn-action {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
}

/* --- HF preview --- */

.hf-preview {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    flex-wrap: wrap;
}

.hf-label {
    color: var(--text-secondary);
}

.hf-value {
    font-weight: 600;
    font-family: monospace;
}

.hf-value.safe, .hf-safe {
    color: #28a745;
}

.hf-value.warning, .hf-warning {
    color: #ffc107;
}

.hf-value.danger, .hf-danger {
    color: #dc3545;
}

.hf-arrow {
    color: var(--text-muted);
}

.hf-warning-text {
    color: #dc3545;
    font-size: 0.75rem;
    width: 100%;
}

.hf-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- Execution steps --- */

.operation-steps {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.step-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.step-icon {
    flex: 0 0 24px;
    text-align: center;
}

.icon-pending {
    color: var(--text-muted);
    font-size: 1rem;
}

.icon-progress {
    color: var(--accent);
}

.icon-completed {
    color: #28a745;
    font-weight: 700;
    font-size: 1rem;
}

.icon-failed {
    color: #dc3545;
    font-weight: 700;
    font-size: 1rem;
}

.step-name {
    font-weight: 500;
    flex: 1;
}

.step-tx {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.step-error {
    font-size: 0.8rem;
    color: #dc3545;
    width: 100%;
    margin-top: 0.25rem;
}

/* Error / Warning messages */
.operation-error-message {
    margin-top: 1rem;
    padding: 0.75rem;
    background-color: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 6px;
    color: #dc3545;
    font-size: 0.85rem;
}

.operation-partial-warning {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background-color: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 6px;
    color: #856404;
    font-size: 0.85rem;
}

/* Footer */
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-default);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* --- Legacy aliases (backward compat) --- */

.btn-transfer {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
}

.btn-confirm {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
}
