/* ============================================================
   Settings module
   ============================================================ */

/* ── Section wrapper ────────────────────────────────────────── */

.r33-settings-section {
    background   : var(--r33-card-bg, #1a1a2e);
    border       : 1px solid var(--r33-border, rgba(255,255,255,.08));
    border-radius: var(--r33-radius, 12px);
    padding      : 24px;
    margin-bottom: 20px;
}

.r33-settings-section-title {
    margin     : 0 0 20px;
    font-size  : 1rem;
    font-weight: 600;
    color      : var(--r33-text-primary, #fff);
}

/* ── Row ────────────────────────────────────────────────────── */

.r33-settings-row {
    display        : flex;
    align-items    : center;
    justify-content: space-between;
    gap            : 16px;
    padding        : 16px 0;
    border-bottom  : 1px solid var(--r33-border, rgba(255,255,255,.06));
}

.r33-settings-row:last-of-type,
.r33-settings-row:last-child {
    border-bottom: none;
}

.r33-settings-row-info {
    display       : flex;
    flex-direction: column;
    gap           : 4px;
    flex          : 1;
}

.r33-settings-row-label {
    font-size  : 0.9rem;
    font-weight: 500;
    color      : var(--r33-text-primary, #fff);
}

.r33-settings-row-desc {
    font-size  : 0.80rem;
    color      : var(--r33-text-muted, #888);
    line-height: 1.45;
}

/* ── Toggle switch ──────────────────────────────────────────── */

.r33-toggle {
    position   : relative;
    display    : inline-flex;
    align-items: center;
    flex-shrink: 0;
    cursor     : pointer;
}

.r33-toggle input[type="checkbox"] {
    position: absolute;
    opacity : 0;
    width   : 0;
    height  : 0;
}

.r33-toggle-track {
    display      : block;
    width        : 44px;
    height       : 24px;
    background   : rgba(255,255,255,.12);
    border-radius: 99px;
    transition   : background .2s;
    position     : relative;
}

.r33-toggle-track::after {
    content      : '';
    position     : absolute;
    top          : 3px;
    left         : 3px;
    width        : 18px;
    height       : 18px;
    background   : #fff;
    border-radius: 50%;
    transition   : transform .2s;
}

.r33-toggle input:checked + .r33-toggle-track {
    background: var(--r33-accent, #e91e8c);
}

.r33-toggle input:checked + .r33-toggle-track::after {
    transform: translateX(20px);
}

/* ── Action buttons ─────────────────────────────────────────── */

.r33-settings-action-btn {
    display        : inline-flex;
    align-items    : center;
    padding        : 8px 16px;
    border-radius  : var(--r33-radius-sm, 8px);
    background     : rgba(255,255,255,.06);
    border         : 1px solid rgba(255,255,255,.10);
    color          : var(--r33-text-secondary, #ccc);
    font-size      : 0.82rem;
    font-weight    : 600;
    text-decoration: none;
    white-space    : nowrap;
    transition     : background .15s, border-color .15s;
    flex-shrink    : 0;
}

.r33-settings-action-btn:hover {
    background  : rgba(255,255,255,.10);
    border-color: rgba(255,255,255,.20);
    color       : var(--r33-text-primary, #fff);
}

/* ── Danger row ─────────────────────────────────────────────── */

.r33-settings-row--danger .r33-settings-row-label {
    color: rgba(231, 76, 60, .9);
}

.r33-settings-danger-btn {
    display     : inline-flex;
    align-items : center;
    padding     : 8px 16px;
    border-radius: var(--r33-radius-sm, 8px);
    background  : rgba(231,76,60,.08);
    border      : 1px solid rgba(231,76,60,.20);
    color       : #e74c3c;
    font-size   : 0.82rem;
    font-weight : 600;
    cursor      : pointer;
    white-space : nowrap;
    transition  : background .15s, border-color .15s;
    flex-shrink : 0;
}

.r33-settings-danger-btn:hover {
    background  : rgba(231,76,60,.15);
    border-color: rgba(231,76,60,.40);
}

/* ── Form footer ────────────────────────────────────────────── */

.r33-settings-footer {
    display    : flex;
    align-items: center;
    gap        : 14px;
    margin-top : 20px;
}

/* ── Status message ─────────────────────────────────────────── */

.r33-settings-status {
    margin    : 0;
    font-size : 0.82rem;
    color     : var(--r33-text-muted, #888);
    min-height: 1.2em;
}

/* ── Block-layout row (stacks info above field) ─────────────── */

.r33-settings-row--block {
    flex-wrap: wrap;
}

.r33-settings-row--block .r33-settings-row-info {
    flex: 1 1 100%;
}

.r33-field-row--full {
    width: 100%;
}

/* ── Country tag grid ────────────────────────────────────────── */

.r33-country-grid {
    display  : flex;
    flex-wrap: wrap;
    gap      : 8px;
    padding  : 20px 0 16px;
}

.r33-country-tag {
    display       : inline-flex;
    align-items   : center;
    min-height    : 36px;
    padding       : 6px 12px;
    border-radius : 99px;
    border        : 1px solid rgba(255,255,255,.10);
    background    : rgba(255,255,255,.04);
    color         : var(--r33-text-muted, #888);
    font-size     : 0.80rem;
    font-weight   : 500;
    cursor        : pointer;
    user-select   : none;
    transition    : background .15s, border-color .15s, color .15s;
}

.r33-country-tag input[type="checkbox"] {
    position: absolute;
    opacity : 0;
    width   : 0;
    height  : 0;
    pointer-events: none;
}

.r33-country-tag:hover {
    background  : rgba(255,255,255,.08);
    border-color: rgba(255,255,255,.20);
    color       : var(--r33-text-primary, #fff);
}

.r33-country-tag--active,
.r33-country-tag:has(input:checked) {
    background  : var(--r33-accent, #e91e8c);
    border-color: var(--r33-accent, #e91e8c);
    color       : #fff;
}

/* ── Text / select / textarea inputs ────────────────────────── */

.r33-settings-input,
.r33-settings-select,
.r33-settings-textarea {
    background   : rgba(255,255,255,.05);
    border       : 1px solid rgba(255,255,255,.12);
    border-radius: var(--r33-radius-sm, 8px);
    color        : var(--r33-text-primary, #fff);
    font-size    : 0.875rem;
    padding      : 10px 14px;
    width        : 220px;
    max-width    : 100%;
    transition   : border-color .15s, background .15s;
    appearance   : none;
    -webkit-appearance: none;
}

.r33-settings-input::placeholder,
.r33-settings-textarea::placeholder {
    color: rgba(255,255,255,.28);
}

.r33-settings-input:focus,
.r33-settings-select:focus,
.r33-settings-textarea:focus {
    outline     : none;
    border-color: var(--r33-accent, #e91e8c);
    background  : rgba(255,255,255,.07);
}

.r33-settings-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat  : no-repeat;
    background-position: right 12px center;
    padding-right      : 36px;
    cursor             : pointer;
}

.r33-settings-select option {
    background: #1a1a2e;
    color     : #fff;
}

.r33-settings-textarea {
    width     : 100%;
    resize    : vertical;
    min-height: 90px;
    line-height: 1.5;
}

/* ── Operating hours row — handled by availability.css ───────── */

/* ── Tag input (covered cities) ──────────────────────────────── */

.r33-tag-input {
    position     : relative;
    background   : rgba(255,255,255,.05);
    border       : 1px solid rgba(255,255,255,.12);
    border-radius: var(--r33-radius-sm, 8px);
    padding      : 8px 10px;
    min-height   : 46px;
    width        : 100%;
    cursor       : text;
    transition   : border-color .15s;
}

.r33-tag-input:focus-within {
    border-color: var(--r33-accent, #e91e8c);
}

.r33-tag-input__tags {
    display    : flex;
    flex-wrap  : wrap;
    align-items: center;
    gap        : 6px;
}

.r33-tag {
    display     : inline-flex;
    align-items : center;
    gap         : 4px;
    background  : rgba(233,30,140,.18);
    border      : 1px solid rgba(233,30,140,.35);
    border-radius: 99px;
    padding     : 3px 10px 3px 10px;
    font-size   : 0.78rem;
    color       : var(--r33-text-primary, #fff);
    white-space : nowrap;
    line-height : 1.4;
}

.r33-tag__remove {
    background  : none;
    border      : none;
    padding     : 0;
    margin-left : 2px;
    color       : rgba(255,255,255,.50);
    font-size   : 1rem;
    line-height : 1;
    cursor      : pointer;
    transition  : color .15s;
    display     : flex;
    align-items : center;
}

.r33-tag__remove:hover {
    color: #fff;
}

.r33-tag-input__field {
    background: none;
    border    : none;
    outline   : none;
    color     : var(--r33-text-primary, #fff);
    font-size : 0.875rem;
    min-width : 140px;
    flex      : 1;
    padding   : 2px 4px;
}

.r33-tag-input__field::placeholder {
    color: rgba(255,255,255,.28);
}

/* ── Typeahead wrap (base city) ──────────────────────────────── */

.r33-typeahead-wrap {
    position : relative;
    display  : inline-block;
}

/* ── City autocomplete dropdown ──────────────────────────────── */

.r33-city-dropdown {
    position     : absolute;
    top          : calc(100% + 4px);
    left         : 0;
    right        : 0;
    z-index      : 200;
    list-style   : none;
    margin       : 0;
    padding      : 4px 0;
    background   : var(--r33-card-bg, #1a1a2e);
    border       : 1px solid rgba(255,255,255,.15);
    border-radius: var(--r33-radius-sm, 8px);
    box-shadow   : 0 8px 24px rgba(0,0,0,.45);
    max-height   : 220px;
    overflow-y   : auto;
    display      : none;
}

.r33-city-dropdown.is-open { display: block; }

.r33-city-option {
    padding   : 9px 14px;
    cursor    : pointer;
    font-size : 0.875rem;
    color     : var(--r33-text-primary, #fff);
    transition: background .12s;
}

.r33-city-option:hover,
.r33-city-option.is-active { background: rgba(255,255,255,.07); }

/* Tag input — bleed dropdown past the box padding */
.r33-tag-input .r33-city-dropdown {
    left : -10px;
    right: -10px;
}

/* ── Private badge ───────────────────────────────────────────── */

.r33-private-badge {
    display      : inline-block;
    margin-left  : 8px;
    padding      : 2px 8px;
    border-radius: 99px;
    font-size    : 0.70rem;
    font-weight  : 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background   : rgba(255,255,255,.07);
    border       : 1px solid rgba(255,255,255,.12);
    color        : var(--r33-text-muted, #888);
    vertical-align: middle;
}

/* ── Inline save status ──────────────────────────────────────── */

.r33-inline-status {
    font-size : 0.82rem;
    color     : var(--r33-text-muted, #888);
    min-height: 1.2em;
    transition: color .2s;
}

.r33-inline-status.is-success { color: #4caf50; }
.r33-inline-status.is-error   { color: #e74c3c; }

/* ── Agency profile: cover + logo upload ────────────────────── */

.r33-biz-cover-section {
    margin-bottom: 24px;
}

.r33-biz-image-actions {
    display    : flex;
    align-items: center;
    gap        : 16px;
    margin-top : 8px;
}

.r33-biz-image-actions .r33-settings-row-desc {
    margin: 0;
    flex  : 1;
}

.r33-danger-link {
    background  : none;
    border      : none;
    padding     : 0;
    font-size   : 0.78rem;
    color       : #e05555;
    cursor      : pointer;
    white-space : nowrap;
    opacity     : 0.8;
    transition  : opacity .15s;
    flex-shrink : 0;
}

.r33-danger-link:hover {
    opacity: 1;
}

.r33-biz-cover-preview {
    position        : relative;
    width           : 100%;
    height          : 180px;
    background-color: rgba(255,255,255,.04);
    border          : 2px dashed rgba(255,255,255,.12);
    border-radius   : var(--r33-radius, 12px);
    display         : flex;
    align-items     : center;
    justify-content : center;
    background-size : cover;
    background-position: center;
    overflow        : hidden;
}

.r33-biz-cover-preview.has-image {
    border-style: solid;
    border-color: rgba(255,255,255,.08);
}

.r33-biz-cover-upload-btn {
    display        : inline-flex;
    align-items    : center;
    padding        : 8px 18px;
    background     : rgba(0,0,0,.50);
    border         : 1px solid rgba(255,255,255,.22);
    border-radius  : var(--r33-radius-sm, 8px);
    color          : #fff;
    font-size      : 0.82rem;
    font-weight    : 600;
    cursor         : pointer;
    transition     : background .15s;
    backdrop-filter: blur(4px);
}

.r33-biz-cover-preview:not(.has-image) .r33-biz-cover-upload-btn {
    background  : rgba(255,255,255,.07);
    border-color: rgba(255,255,255,.15);
}

.r33-biz-cover-upload-btn:hover {
    background: rgba(0,0,0,.68);
}

.r33-biz-logo-uploader {
    display    : flex;
    align-items: center;
    gap        : 12px;
    flex-shrink: 0;
}

.r33-biz-logo-preview {
    width          : 72px;
    height         : 72px;
    border-radius  : 50%;
    overflow       : hidden;
    background     : rgba(255,255,255,.08);
    border         : 2px solid rgba(255,255,255,.12);
    display        : flex;
    align-items    : center;
    justify-content: center;
    flex-shrink    : 0;
}

.r33-biz-logo-preview img {
    width     : 100%;
    height    : 100%;
    object-fit: cover;
}

.r33-biz-logo-initials {
    font-size  : 1.4rem;
    font-weight: 700;
    color      : rgba(255,255,255,.38);
    line-height: 1;
}

/* ── Responsive ─────────────────────────────────────────────── */

@media (max-width: 560px) {
    .r33-settings-row {
        flex-wrap: wrap;
    }

    .r33-settings-row-info {
        flex: 1 1 100%;
    }
}
