/* ==========================================================================
   Promptor v2 — Settings / UI Settings
   Onaylı mockup: scratch-design/v2-extract/V2Settings.dc.html
   Tüm kurallar #promptor-ui-settings-form kapsamındadır; form alanlarının
   name/id değerleri, renk seçici ve canlı önizleme kancaları değişmez —
   yalnızca sunum katmanı mockup'a taşınır.
   ========================================================================== */

/* --- Kart standardı --- */
body.promptor-v2 #promptor-ui-settings-form .postbox > .hndle {
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 650;
}
body.promptor-v2 #promptor-ui-settings-form .postbox > .inside { padding: 20px; }
body.promptor-v2 #promptor-ui-settings-form .postbox > .inside > p:first-child {
    margin: 0 0 16px;
    font-size: 12px;
    color: var(--pa6-shell-nav);
}

/* --- form-table → etiketi üstte, blok alanlar --- */
body.promptor-v2 #promptor-ui-settings-form .form-table,
body.promptor-v2 #promptor-ui-settings-form .form-table > tbody,
body.promptor-v2 #promptor-ui-settings-form .form-table tr,
body.promptor-v2 #promptor-ui-settings-form .form-table th,
body.promptor-v2 #promptor-ui-settings-form .form-table td {
    display: block;
    width: auto;
    max-width: none;
}
body.promptor-v2 #promptor-ui-settings-form .form-table { margin: 0; }
body.promptor-v2 #promptor-ui-settings-form .form-table tr + tr { margin-top: 16px; }
body.promptor-v2 #promptor-ui-settings-form .form-table th {
    padding: 0 0 6px;
    font-size: 12.5px;
    font-weight: 650;
    color: #334155;
    line-height: 1.4;
}
body.promptor-v2.promptor-dark #promptor-ui-settings-form .form-table th { color: var(--pa6-shell-text); }
body.promptor-v2 #promptor-ui-settings-form .form-table td { padding: 0; }
body.promptor-v2 #promptor-ui-settings-form .form-table td .description,
body.promptor-v2 #promptor-ui-settings-form .description {
    margin: 6px 0 0;
    font-size: 11.5px;
    color: var(--pa6-shell-muted);
}

/* --- Girdi alanları --- */
body.promptor-v2 #promptor-ui-settings-form input[type="text"],
body.promptor-v2 #promptor-ui-settings-form input[type="url"],
body.promptor-v2 #promptor-ui-settings-form input[type="number"],
body.promptor-v2 #promptor-ui-settings-form select,
body.promptor-v2 #promptor-ui-settings-form textarea {
    border-radius: 8px;
    border-color: var(--pa6-input-border);
    padding: 8px 12px;
    font-size: 13px;
    min-height: 0;
    line-height: 1.4;
}
body.promptor-v2 #promptor-ui-settings-form select { padding-right: 28px; }
body.promptor-v2 #promptor-ui-settings-form input[type="text"]:not(.promptor-color-picker),
body.promptor-v2 #promptor-ui-settings-form input[type="url"],
body.promptor-v2 #promptor-ui-settings-form select { width: 100%; max-width: 420px; }
body.promptor-v2 #promptor-ui-settings-form input[type="number"] { width: 96px; }

/* --- İki sütunlu kart grupları (Genel Görünüm / Avatarlar) --- */
body.promptor-v2 #promptor-ui-settings-form .promptor-grid-2-col { gap: 16px; }

/* --- Renk paleti: mockup'taki çerçeveli swatch ızgarası --- */
body.promptor-v2 #promptor-ui-settings-form .postbox .promptor-grid-2-col > div > .form-table tr {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--pa6-card-border);
    border-radius: 8px;
    padding: 8px 10px;
    background: var(--pa6-shell-bg);
}
body.promptor-v2 #promptor-ui-settings-form .postbox .promptor-grid-2-col > div > .form-table tr + tr { margin-top: 10px; }
body.promptor-v2 #promptor-ui-settings-form .postbox .promptor-grid-2-col > div > .form-table th {
    padding: 0;
    font-size: 11.5px;
    font-weight: 650;
    flex: 1;
    min-width: 0;
}
body.promptor-v2 #promptor-ui-settings-form .postbox .promptor-grid-2-col > div > .form-table td {
    padding: 0;
    flex-shrink: 0;
}
body.promptor-v2 #promptor-ui-settings-form .postbox .promptor-grid-2-col > div > .form-table td .description {
    display: none; /* Çip içinde yer yok; açıklama kart başlığında zaten var. */
}
body.promptor-v2 #promptor-ui-settings-form .wp-picker-container .wp-color-result.button {
    border-radius: 7px;
    border-color: var(--pa6-input-border);
    height: 30px;
    margin: 0;
}

/* --- Toggle anahtarları: gerçek checkbox korunur, görünüm anahtara döner --- */
body.promptor-v2 #promptor-ui-settings-form .form-table td > label > input[type="checkbox"],
body.promptor-v2 #promptor-ui-settings-form fieldset > label > input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    width: 34px;
    height: 19px;
    border: 0;
    border-radius: 999px;
    background: #cbd5e1;
    margin: 0 10px 0 0;
    vertical-align: middle;
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.15s ease;
    box-shadow: none;
}
body.promptor-v2 #promptor-ui-settings-form .form-table td > label > input[type="checkbox"]::after,
body.promptor-v2 #promptor-ui-settings-form fieldset > label > input[type="checkbox"]::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #ffffff;
    transition: transform 0.15s ease;
}
body.promptor-v2 #promptor-ui-settings-form .form-table td > label > input[type="checkbox"]:checked,
body.promptor-v2 #promptor-ui-settings-form fieldset > label > input[type="checkbox"]:checked { background: #0284c7; }
body.promptor-v2 #promptor-ui-settings-form .form-table td > label > input[type="checkbox"]:checked::after,
body.promptor-v2 #promptor-ui-settings-form fieldset > label > input[type="checkbox"]:checked::after { transform: translateX(15px); }
body.promptor-v2 #promptor-ui-settings-form .form-table td > label > input[type="checkbox"]:focus-visible,
body.promptor-v2 #promptor-ui-settings-form fieldset > label > input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--pa6-tab-active);
    outline-offset: 2px;
}
/* Anahtarın içinde ayrıca WP'nin ✓ işareti görünmesin. */
body.promptor-v2 #promptor-ui-settings-form .form-table td > label > input[type="checkbox"]::before,
body.promptor-v2 #promptor-ui-settings-form fieldset > label > input[type="checkbox"]::before {
    content: none;
    display: none;
}
body.promptor-v2 #promptor-ui-settings-form .form-table td > label {
    display: flex;
    align-items: flex-start;
    font-size: 12.5px;
    font-weight: 600;
    color: #334155;
    line-height: 1.5;
}
body.promptor-v2.promptor-dark #promptor-ui-settings-form .form-table td > label { color: var(--pa6-shell-text); }
body.promptor-v2 #promptor-ui-settings-form .form-table td > label > input[type="checkbox"] { margin-top: 1px; }

/* --- Admin koyu tema: radyo grubu → segmentli kontrol --- */
body.promptor-v2 #promptor-ui-settings-form fieldset:has(input[name="promptor_admin_dark_mode"]) {
    display: inline-flex;
    gap: 2px;
    background: var(--pa6-thead-bg);
    border: 1px solid var(--pa6-card-border);
    border-radius: 9px;
    padding: 3px;
}
body.promptor-v2 #promptor-ui-settings-form fieldset:has(input[name="promptor_admin_dark_mode"]) > label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 6px 16px;
    border-radius: 7px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--pa6-shell-nav);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
body.promptor-v2 #promptor-ui-settings-form input[name="promptor_admin_dark_mode"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
}
body.promptor-v2 #promptor-ui-settings-form fieldset > label:has(input[name="promptor_admin_dark_mode"]:checked) {
    background: var(--pa6-shell-bg);
    color: var(--pa6-shell-text);
    font-weight: 650;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
body.promptor-v2 #promptor-ui-settings-form fieldset > label:has(input[name="promptor_admin_dark_mode"]:focus-visible) {
    outline: 2px solid var(--pa6-tab-active);
    outline-offset: 1px;
}
body.promptor-v2 #promptor-ui-settings-form fieldset:has(input[name="promptor_admin_dark_mode"]) .dashicons {
    font-size: 15px;
    width: 15px;
    height: 15px;
}

/* --- Bot avatarı: dosya adı + butonlar tek satırda --- */
body.promptor-v2 #promptor-ui-settings-form .promptor-avatar-filename {
    display: inline-block;
    font-size: 12px;
    color: var(--pa6-shell-muted);
    margin-right: 10px;
    vertical-align: middle;
}

/* --- Canlı önizleme sütunu: yapışkan kart --- */
body.promptor-v2 #promptor-ui-settings-form .promptor-ui-preview-column #preview-postbox {
    position: sticky;
    top: 46px;
}

/* --- Kaydet butonu: kart dışında, gradyanı paylaşılan katmandan alır --- */
body.promptor-v2 #promptor-ui-settings-form .submit { margin-top: 4px; padding: 0; }

/* --- Segmentli kontrol (Widget Theme): radyo grubu, görsel olarak segment --- */
body.promptor-v2 #promptor-ui-settings-form .promptor-segmented {
    display: inline-flex;
    gap: 2px;
    background: var(--pa6-thead-bg);
    border: 1px solid var(--pa6-card-border);
    border-radius: 9px;
    padding: 3px;
}
body.promptor-v2 #promptor-ui-settings-form .promptor-segmented-option {
    display: inline-flex;
    align-items: center;
    margin: 0;
    cursor: pointer;
}
body.promptor-v2 #promptor-ui-settings-form .promptor-segmented-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
}
body.promptor-v2 #promptor-ui-settings-form .promptor-segmented-option > span {
    display: inline-block;
    padding: 6px 18px;
    border-radius: 7px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--pa6-shell-nav);
    transition: background 0.15s ease, color 0.15s ease;
}
body.promptor-v2 #promptor-ui-settings-form .promptor-segmented-option input[type="radio"]:checked + span {
    background: var(--pa6-shell-bg);
    color: var(--pa6-shell-text);
    font-weight: 650;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
body.promptor-v2 #promptor-ui-settings-form .promptor-segmented-option input[type="radio"]:focus-visible + span {
    outline: 2px solid var(--pa6-tab-active);
    outline-offset: 1px;
}

/* --- Renk paleti: mockup'taki 4 sütunlu swatch ızgarası ---
   İç sarmalayıcılar display:contents ile şeffaflaşır, böylece her renk
   satırı doğrudan ızgara öğesi olur. */
body.promptor-v2 #promptor-ui-settings-form .promptor-colors-card .promptor-grid-2-col {
    display: grid;
    /* Kart genişliğine göre 2-4 sütun: sağdaki canlı önizleme sütunu
       nedeniyle alan dar olduğunda çiplerin okunurluğu korunur. */
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: 10px;
}
body.promptor-v2 #promptor-ui-settings-form .promptor-colors-card .promptor-grid-2-col > div,
body.promptor-v2 #promptor-ui-settings-form .promptor-colors-card .promptor-grid-2-col > div > .form-table,
body.promptor-v2 #promptor-ui-settings-form .promptor-colors-card .promptor-grid-2-col > div > .form-table > tbody {
    display: contents;
}
body.promptor-v2 #promptor-ui-settings-form .promptor-colors-card .promptor-grid-2-col > div > .form-table tr + tr { margin-top: 0; }


/* --- Canlı önizleme: koyu tema ve animasyon yansıması (v2.0.0) --- */
body.promptor-v2 #promptor-preview-widget.is-dark {
    border-color: rgba(255, 255, 255, 0.08);
}

body.promptor-v2 #promptor-preview-widget.is-dark #promptor-preview-subtitle {
    color: rgba(255, 255, 255, 0.72);
}

body.promptor-v2 #promptor-preview-widget.is-dark #promptor-preview-footer {
    background: #0b1220;
    border-top-color: rgba(255, 255, 255, 0.06);
}

body.promptor-v2 #promptor-preview-widget.is-dark #promptor-preview-footer input {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

body.promptor-v2 #promptor-preview-widget.is-dark #promptor-preview-footer input::placeholder {
    color: #64748b;
}

@keyframes promptorPreviewFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes promptorPreviewSlide {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

body.promptor-v2 .promptor-preview-message.promptor-anim-fade {
    animation: promptorPreviewFade 0.35s ease both;
}

body.promptor-v2 .promptor-preview-message.promptor-anim-slide {
    animation: promptorPreviewSlide 0.35s ease both;
}

@media (prefers-reduced-motion: reduce) {
    body.promptor-v2 .promptor-preview-message.promptor-anim-fade,
    body.promptor-v2 .promptor-preview-message.promptor-anim-slide {
        animation: none;
    }
}
