/* ═══ 11. MODALS ═══ */

/* ─── Modal ─────────────────────────────── */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal[hidden] { display: none; }

/* ─── Confirm-Dialog ────────────────────── */
.confirm-modal-content {
    width: 400px;
    max-width: min(400px, 95vw);
}
.confirm-modal-body {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 24px 24px 16px;
}
.confirm-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-hover);
    color: var(--text-secondary);
}
.confirm-icon.danger {
    background: var(--red-bg);
    color: var(--red);
}
.confirm-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}
.confirm-message {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: var(--modal-backdrop);
}

.modal-content {
    position: relative;
    background: var(--surface);
    border-radius: 12px;
    width: 480px;
    max-width: min(480px, 95vw);
    max-height: min(90vh, 820px);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 16px 24px 12px;
    min-width: 0;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}

/* Buttons im Header dürfen sich nicht zusammenstauchen */
.modal-header > button { flex-shrink: 0; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

.modal-body {
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 24px 16px;
    flex-shrink: 0;
    border-top: 1px solid var(--border);
}

/* ═══ 12. FORMS / INPUTS ═══ */

/* ─── Form ──────────────────────────────── */
.form-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.form-group.flex-2 { flex: 2; }

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Kauf/Verkauf-Toggle gleiche Höhe wie .input */
.form-group .btn-group.full-width {
    height: 38px;
}

.form-group .btn-group.full-width .btn-sm {
    flex: 1;
    height: 100%;
    padding: 0 12px;
    font-size: 13px;
    justify-content: center;
}

.input {
    width: 100%;
    box-sizing: border-box;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    color: var(--text);
    font-family: var(--font-body);
    outline: none;
    transition: border-color 0.2s;
}

.input:focus { border-color: var(--accent); }
.input.mono { font-family: var(--font-mono); }
.tx-datetime-row { display: flex; gap: 8px; }
.tx-datetime-row .input { min-width: 0; flex: 1; }
/* iOS: Kalender/Uhr-Icon ausblenden */
.tx-datetime-row input::-webkit-calendar-picker-indicator { display: none; }

.input-pw-wrap { position: relative; }
.input-pw-wrap .input { padding-right: 42px; width: 100%; box-sizing: border-box; }
.btn-eye {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}
.btn-eye:hover { color: var(--text); }
.btn-eye svg { width: 18px; height: 18px; }

select.input {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237A8599' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* ── Symbol Autocomplete ── */
.sym-ac-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    z-index: 2000;
    overflow: hidden;
    max-height: 260px;
    overflow-y: auto;
}

.sym-ac-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.12s;
}

.sym-ac-item:hover,
.sym-ac-item.active {
    background: var(--hover);
}

.sym-ac-logo {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: contain;
    flex-shrink: 0;
    background: #fff;
}

.sym-ac-logo-fb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    flex-shrink: 0;
}

.sym-ac-sym {
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.sym-ac-name {
    font-size: 12px;
    color: var(--text-secondary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sym-ac-price {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-left: auto;
}

.input-price-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}
.input-price-wrap .input {
    flex: 1;
    min-width: 0;
}
.btn-fetch-price {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-fetch-price:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}
.btn-fetch-price.loading {
    pointer-events: none;
    color: var(--accent);
}
.btn-fetch-price.loading svg {
    animation: spin-icon 0.7s linear infinite;
}
@keyframes spin-icon {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.sym-ac-price-hint {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    font-size: 11px;
    color: var(--accent);
    padding-left: 2px;
    white-space: nowrap;
    pointer-events: none;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0 0;
    border-top: 1px solid var(--border);
    font-size: 16px;
    font-weight: 600;
}

