/**
 * Yakura Commenti — Admin Settings Styles
 *
 * Modern card-based UI with toggle switches and tabbed interface.
 */

/* ── Utilities ─────────────────────────────────────────────── */
.yakura-commenti-hidden {
    display: none;
}

/* ── Reset & Base ──────────────────────────────────────────── */
.yakura-commenti-settings-wrap {
    max-width: 900px;
    margin: 20px auto 40px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.yakura-commenti-settings-wrap *,
.yakura-commenti-settings-wrap *::before,
.yakura-commenti-settings-wrap *::after {
    box-sizing: border-box;
}

/* ── Header ────────────────────────────────────────────────── */
.yakura-commenti-settings-header {
    margin-bottom: 24px;
}

.yakura-commenti-settings-header h1 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 26px;
    font-weight: 600;
    color: #1d2327;
    margin: 0 0 6px;
}

.yakura-commenti-settings-header h1 .yakura-commenti-logo {
    width: 28px;
    height: 28px;
    vertical-align: middle;
    margin-right: 4px;
}

.yakura-commenti-version {
    font-size: 12px;
    font-weight: 400;
    color: #787c82;
    background: #f0f0f1;
    padding: 2px 8px;
    border-radius: 10px;
}

.yakura-commenti-subtitle {
    color: #646970;
    margin: 0;
    font-size: 14px;
}

/* ── Tabs ──────────────────────────────────────────────────── */
.yakura-commenti-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 0;
}

.yakura-commenti-tab {
    padding: 10px 18px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: #646970;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.yakura-commenti-tab:hover {
    color: #2271b1;
    background: rgba(34, 113, 177, 0.04);
}

.yakura-commenti-tab--active {
    color: #2271b1;
    border-bottom-color: #2271b1;
    font-weight: 600;
}

/* ── Panels ────────────────────────────────────────────────── */
.yakura-commenti-panel {
    display: none;
    padding-top: 24px;
}

.yakura-commenti-panel--active {
    display: block;
}

/* ── Cards ─────────────────────────────────────────────────── */
.yakura-commenti-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.yakura-commenti-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.yakura-commenti-card__title {
    font-size: 15px;
    font-weight: 700;
    color: #1d2327;
    margin: 0 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.yakura-commenti-card__desc {
    color: #646970;
    font-size: 13px;
    margin: 0 0 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f1;
    line-height: 1.5;
}

/* ── Setting Rows ──────────────────────────────────────────── */
.yakura-commenti-setting-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid #f0f0f1;
    gap: 20px;
}

.yakura-commenti-setting-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.yakura-commenti-setting-row:first-of-type {
    padding-top: 0;
}

.yakura-commenti-setting-row__info {
    flex: 1;
}

.yakura-commenti-setting-row__info label {
    font-size: 14px;
    font-weight: 500;
    color: #1d2327;
    cursor: pointer;
}

.yakura-commenti-setting-row__help {
    font-size: 12px;
    color: #787c82;
    margin: 4px 0 0;
    line-height: 1.5;
}

.yakura-commenti-setting-row__control {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Conditional rows (hidden when dependency is unchecked). */
.yakura-commenti-setting-row--conditional {
    transition: opacity 0.2s ease;
}

.yakura-commenti-setting-row--conditional.yakura-commenti-hidden {
    display: none;
}

/* ── Toggle Switch ─────────────────────────────────────────── */
.yakura-commenti-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.yakura-commenti-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.yakura-commenti-toggle__slider {
    position: absolute;
    inset: 0;
    background: #c3c4c7;
    border-radius: 24px;
    transition: background 0.25s ease;
}

.yakura-commenti-toggle__slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.yakura-commenti-toggle input:checked + .yakura-commenti-toggle__slider {
    background: #2271b1;
}

.yakura-commenti-toggle input:checked + .yakura-commenti-toggle__slider::before {
    transform: translateX(20px);
}

.yakura-commenti-toggle input:focus-visible + .yakura-commenti-toggle__slider {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* ── Inputs ────────────────────────────────────────────────── */
.yakura-commenti-input {
    padding: 6px 12px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    font-size: 13px;
    color: #1d2327;
    transition: border-color 0.2s ease;
}

.yakura-commenti-input:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
}

.yakura-commenti-input--number {
    width: 80px;
    text-align: center;
}

.yakura-commenti-input-suffix {
    color: #787c82;
    font-size: 13px;
}

/* ── Post Type Grid ────────────────────────────────────────── */
.yakura-commenti-post-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.yakura-commenti-post-type-card {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.yakura-commenti-post-type-card:hover {
    border-color: #c3c4c7;
}

.yakura-commenti-post-type-card__label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 14px;
    cursor: pointer;
}

.yakura-commenti-post-type-card__label input {
    display: none;
}

.yakura-commenti-post-type-card__check {
    width: 20px;
    height: 20px;
    border: 2px solid #c3c4c7;
    border-radius: 4px;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.yakura-commenti-post-type-card__check::after {
    content: "";
    position: absolute;
    display: none;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.yakura-commenti-post-type-card__label input:checked ~ .yakura-commenti-post-type-card__check {
    background: #2271b1;
    border-color: #2271b1;
}

.yakura-commenti-post-type-card__label input:checked ~ .yakura-commenti-post-type-card__check::after {
    display: block;
}

.yakura-commenti-post-type-card__name {
    font-weight: 500;
    color: #1d2327;
    font-size: 14px;
}

.yakura-commenti-post-type-card__slug {
    font-size: 11px;
    color: #787c82;
    width: 100%;
    padding-left: 28px;
    margin-top: -4px;
}

/* ── Roles Grid ────────────────────────────────────────────── */
.yakura-commenti-roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.yakura-commenti-role-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.yakura-commenti-role-item:hover {
    border-color: #c3c4c7;
}

.yakura-commenti-role-item input {
    display: none;
}

.yakura-commenti-role-item__check {
    width: 18px;
    height: 18px;
    border: 2px solid #c3c4c7;
    border-radius: 4px;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.yakura-commenti-role-item__check::after {
    content: "";
    position: absolute;
    display: none;
    left: 4px;
    top: 0;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.yakura-commenti-role-item input:checked ~ .yakura-commenti-role-item__check {
    background: #2271b1;
    border-color: #2271b1;
}

.yakura-commenti-role-item input:checked ~ .yakura-commenti-role-item__check::after {
    display: block;
}

.yakura-commenti-role-item__name {
    font-weight: 500;
    color: #1d2327;
    font-size: 13px;
}

.yakura-commenti-role-item__slug {
    font-size: 11px;
    color: #787c82;
    width: 100%;
    padding-left: 26px;
    margin-top: -4px;
}

/* ── Buttons ───────────────────────────────────────────────── */
.yakura-commenti-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    line-height: 1.4;
}

.yakura-commenti-btn:active {
    transform: scale(0.98);
}

.yakura-commenti-btn--primary {
    background: #2271b1;
    color: #fff;
}

.yakura-commenti-btn--primary:hover {
    background: #135e96;
}

.yakura-commenti-btn--secondary {
    background: #f0f0f1;
    color: #1d2327;
    border: 1px solid #c3c4c7;
}

.yakura-commenti-btn--secondary:hover {
    background: #e0e0e0;
}

.yakura-commenti-btn--danger {
    background: #d63638;
    color: #fff;
}

.yakura-commenti-btn--danger:hover {
    background: #b32d2e;
}

.yakura-commenti-btn--small {
    padding: 5px 12px;
    font-size: 12px;
}

.yakura-commenti-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 16px;
}

.yakura-commenti-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Save Bar ──────────────────────────────────────────────── */
.yakura-commenti-save-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 0 0;
}

.yakura-commenti-save-status {
    font-size: 13px;
    color: #00a32a;
    transition: opacity 0.3s ease;
}

.yakura-commenti-save-status--error {
    color: #d63638;
}

/* Spinner animation */
@keyframes yakura-commenti-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.yakura-commenti-spin {
    animation: yakura-commenti-spin 1s linear infinite;
    display: inline-block;
}

/* ── File Upload ───────────────────────────────────────────── */
.yakura-commenti-file-upload {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.yakura-commenti-file-upload__input {
    display: none;
}

.yakura-commenti-file-upload__label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 24px 16px;
    background: #f6f7f7;
    border: 2px dashed #c3c4c7;
    border-radius: 6px;
    color: #646970;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.yakura-commenti-file-upload__label:hover {
    border-color: #2271b1;
    background: #f0f6fc;
}

.yakura-commenti-file-upload__name {
    font-size: 13px;
    color: #1d2327;
    font-weight: 500;
}

.yakura-commenti-import-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.yakura-commenti-import-section .yakura-commenti-btn {
    align-self: flex-start;
}

.yakura-commenti-import-status {
    font-size: 13px;
    min-height: 20px;
}

.yakura-commenti-export-section {
    padding-top: 4px;
}

/* ── Log Table ─────────────────────────────────────────────── */
.yakura-commenti-log-table-wrap {
    overflow-x: auto;
    margin-top: 12px;
}

.yakura-commenti-log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.yakura-commenti-log-table th {
    text-align: left;
    font-weight: 600;
    color: #1d2327;
    padding: 10px 12px;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
}

.yakura-commenti-log-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f1;
    color: #1d2327;
    vertical-align: top;
}

.yakura-commenti-log-table__date {
    white-space: nowrap;
    color: #787c82;
    font-size: 12px;
}

.yakura-commenti-log-table__details {
    max-width: 300px;
    word-break: break-word;
}

.yakura-commenti-log-table code {
    background: #f0f0f1;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.yakura-commenti-card__header .yakura-commenti-btn {
    flex-shrink: 0;
    align-self: center;
}

/* ── Notices ───────────────────────────────────────────────── */
.yakura-commenti-notice {
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.5;
}

.yakura-commenti-notice--info {
    background: #f0f6fc;
    color: #2271b1;
    border: 1px solid #c3d8e8;
}

.yakura-commenti-notice--success {
    background: #edfaef;
    color: #00a32a;
    border: 1px solid #b8e6bf;
}

.yakura-commenti-notice--warning {
    background: #fcf0e3;
    color: #996800;
    border: 1px solid #e0c48b;
}

.yakura-commenti-notice--error {
    background: #fcf0f1;
    color: #d63638;
    border: 1px solid #e0b0b1;
}

/* ── Tools Page ────────────────────────────────────────────── */
.yakura-commenti-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.yakura-commenti-stats-column h3 {
    margin: 0 0 12px;
}

.yakura-commenti-stat-card {
    background: #f6f7f7;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 16px;
    text-align: center;
    margin-bottom: 8px;
}

.yakura-commenti-stat-card__count {
    font-size: 28px;
    font-weight: 700;
    color: #2271b1;
    display: block;
    margin-bottom: 4px;
}

.yakura-commenti-stat-card__label {
    font-size: 12px;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.yakura-commenti-delete-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.yakura-commenti-select {
    padding: 8px 12px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    font-size: 13px;
    min-width: 200px;
    background: #fff;
}

.yakura-commenti-delete-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.yakura-commenti-delete-status {
    font-size: 13px;
    min-height: 20px;
}

/* ── Wizard ────────────────────────────────────────────────── */
.yakura-commenti-wizard-wrap {
    max-width: 640px;
    margin: 40px auto;
}

.yakura-commenti-wizard-header {
    text-align: center;
    margin-bottom: 32px;
}

.yakura-commenti-wizard-header h1 {
    font-size: 24px;
    color: #1d2327;
    margin: 0 0 8px;
}

.yakura-commenti-wizard-header p {
    color: #646970;
    font-size: 14px;
    margin: 0;
}

.yakura-commenti-wizard-steps {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 32px;
}

.yakura-commenti-wizard-step {
    width: 40px;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    transition: background 0.3s ease;
}

.yakura-commenti-wizard-step--active {
    background: #2271b1;
}

.yakura-commenti-wizard-step--done {
    background: #00a32a;
}

.yakura-commenti-wizard-panel {
    display: none;
}

.yakura-commenti-wizard-panel--active {
    display: block;
}

.yakura-commenti-wizard-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
}

/* ── Multisite Network ─────────────────────────────────────── */
.yakura-commenti-subsite-search {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.yakura-commenti-subsite-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.yakura-commenti-subsite-table th,
.yakura-commenti-subsite-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #f0f0f1;
}

.yakura-commenti-subsite-table th {
    font-weight: 600;
    border-bottom-width: 2px;
    border-bottom-color: #e0e0e0;
}

.yakura-commenti-pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 16px;
}

.yakura-commenti-pagination__btn {
    padding: 4px 10px;
    border: 1px solid #c3c4c7;
    background: #fff;
    border-radius: 3px;
    font-size: 13px;
    cursor: pointer;
}

.yakura-commenti-pagination__btn--active {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

/* ── Comment Types Grid ────────────────────────────────────── */
.yakura-commenti-comment-types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

/* ── Meta Box ──────────────────────────────────────────────── */
.yakura-commenti-meta-box__desc {
    color: #646970;
    font-size: 12px;
    margin: 0 0 10px;
}

.yakura-commenti-meta-box__option {
    display: block;
    margin: 6px 0;
    cursor: pointer;
    font-size: 13px;
}

.yakura-commenti-meta-box__option input {
    margin-right: 6px;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 782px) {
    .yakura-commenti-settings-wrap {
        margin: 10px;
    }

    .yakura-commenti-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .yakura-commenti-setting-row {
        flex-direction: column;
        gap: 10px;
    }

    .yakura-commenti-setting-row__control {
        align-self: flex-start;
    }

    .yakura-commenti-stats-row {
        grid-template-columns: 1fr;
    }

    .yakura-commenti-post-type-grid {
        grid-template-columns: 1fr;
    }
}
