/* assets/css/settings.css */

.page-wrap {
    max-width: 800px;
    margin: 0 auto;
    padding: 72px 24px 60px;
}

.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 20px;
}
.page-header h1 { font-size: 22px; font-weight: 600; margin-bottom: 2px; }
.page-sub { font-size: 13.5px; color: var(--text-muted); }

/* ── Buttons ──────────────────────────────────── */
.btn {
    font-family: inherit; font-size: 13px; font-weight: 500;
    padding: 8px 16px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-dark); background: var(--white);
    color: var(--text); cursor: pointer; transition: all .15s;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-sm { font-size: 12px; padding: 5px 10px; }

/* ── Loading ──────────────────────────────────── */
.loading { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 0; color: var(--text-muted); font-size: 13.5px; }
.spinner { width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--text); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Config sections ──────────────────────────── */
.config-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    overflow: hidden;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    padding: 14px 20px;
    margin: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

/* ── Config row ───────────────────────────────── */
.config-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    position: relative;
}
.config-row:last-child { border-bottom: none; }
.config-row:hover { background: rgba(0,0,0,.01); }

.cr-info {
    flex: 1;
    min-width: 0;
}
.cr-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 2px;
}
.cr-desc {
    display: block;
    font-size: 12px;
    color: var(--text-faint);
    line-height: 1.4;
}

.cr-key {
    position: absolute;
    top: 14px;
    right: 20px;
    font-size: 10px;
    font-family: 'SFMono-Regular', ui-monospace, monospace;
    color: var(--text-faint);
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity .15s;
}
.config-row:hover .cr-key { opacity: 1; }

/* ── Control area ─────────────────────────────── */
.cr-control {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.cr-status {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 20px;
}

/* ── Inline text input ────────────────────────── */
.cr-editable {
    min-width: 200px;
}

.cr-input {
    width: 140px;
    padding: 6px 8px;
    font-size: 13px;
    font-family: 'SFMono-Regular', ui-monospace, monospace;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--white);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.cr-input:focus {
    border-color: var(--text);
    box-shadow: 0 0 0 3px rgba(17,19,24,.08);
}

.cr-save {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ── Toggle ───────────────────────────────────── */
.toggle { position: relative; display: inline-block; width: 38px; height: 22px; cursor: pointer; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
    position: absolute; inset: 0; background: var(--border-dark);
    border-radius: 11px; transition: background .2s;
}
.toggle-slider::before {
    content: ''; position: absolute; top: 3px; left: 3px;
    width: 16px; height: 16px; background: var(--white);
    border-radius: 50%; transition: transform .2s;
    box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.toggle input:checked + .toggle-slider { background: #10b981; }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ── Modal ────────────────────────────────────── */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.35);
    z-index: 200; display: flex; align-items: center;
    justify-content: center; padding: 24px;
}
.modal {
    background: var(--white); border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    width: 100%; max-width: 440px; max-height: 85vh; overflow-y: auto;
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px 0;
}
.modal-header h2 { font-size: 18px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 22px; color: var(--text-muted); cursor: pointer; padding: 4px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 24px 24px; }

/* ── Forms ────────────────────────────────────── */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 5px; }
.form-row input {
    width: 100%; padding: 8px 10px; font-size: 13px; font-family: inherit;
    color: var(--text); border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm); background: var(--white); outline: none;
}
.form-row input:focus { border-color: var(--text); box-shadow: 0 0 0 3px rgba(17,19,24,.08); }
.hint { display: block; font-size: 11px; color: var(--text-faint); margin-top: 4px; }
.form-error {
    display: none; font-size: 13px; color: var(--danger);
    background: var(--danger-bg); border: 1px solid var(--danger-border);
    border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 14px;
}
.form-footer { display: flex; justify-content: flex-end; gap: 8px; padding-top: 6px; }

@media (max-width: 640px) {
    .config-row { flex-direction: column; align-items: flex-start; gap: 8px; }
    .cr-editable { min-width: 100%; }
    .cr-input { width: 100%; }
    .cr-key { position: static; opacity: 1; margin-top: 4px; }
}