/**
 * Memory Matching Game - Settings Modal Stylesheet
 * ABC Website (abcwebsite.com.vn)
 * Matches Vòng Quay May Mắn style & UX
 */

.settings-modal-card {
    font-family: var(--font-family, 'Be Vietnam Pro', 'Plus Jakarta Sans', system-ui, sans-serif);
    background: #ffffff;
    color: #0f172a;
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
    position: relative;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.settings-modal-card input,
.settings-modal-card select,
.settings-modal-card button {
    font-family: inherit;
}

.memory-modal.is-active .settings-modal-card {
    transform: scale(1) translateY(0);
}

/* Header Modal */
.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.settings-header h3 {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-header p {
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
}

/* Body Modal (Cuộn được) */
.settings-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.settings-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pairs-count-badge {
    font-size: 12px;
    font-weight: 700;
    color: #0f75bd;
    background: #e0f2fe;
    padding: 4px 10px;
    border-radius: 999px;
    text-transform: none;
    letter-spacing: 0;
}

/* Grid cài đặt */
.settings-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.settings-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.settings-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-field label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.settings-field input[type="text"],
.settings-field input[type="number"],
.settings-field select {
    height: 40px;
    padding: 0 12px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    color: #0f172a;
    background: #ffffff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.settings-field input[type="text"]:focus,
.settings-field input[type="number"]:focus,
.settings-field select:focus {
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

/* ----------------------------------------------------
   DANH SÁCH CẶP THẺ BÀI (THÊM / BỚT TRỰC QUAN)
   ---------------------------------------------------- */
.settings-pairs-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-pair-row {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.2s ease;
}

.card-pair-row:hover {
    border-color: #cbd5e1;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.card-pair-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-pair-badge {
    font-size: 12px;
    font-weight: 800;
    color: #0f75bd;
    background: #e0f2fe;
    padding: 3px 10px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-remove-pair {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}
.btn-remove-pair:hover:not(:disabled) {
    color: #ef4444;
    background: #fee2e2;
}
.btn-remove-pair:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.card-pair-body {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pair-preview-box {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

.pair-preview-box img,
.pair-preview-box svg {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

.pair-inputs-wrap {
    flex: 1;
    display: flex;
    gap: 10px;
    align-items: center;
}

.pair-inputs-wrap input[type="text"] {
    flex: 1;
    height: 38px;
    padding: 0 10px;
    font-size: 13.5px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    outline: none;
}
.pair-inputs-wrap input[type="text"]:focus {
    border-color: #0f75bd;
}

.pair-inputs-wrap select {
    width: 140px;
    height: 38px;
    padding: 0 8px;
    font-size: 13px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
}

.btn-upload-pair-icon {
    height: 38px;
    padding: 0 12px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    transition: all 0.2s;
}
.btn-upload-pair-icon:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

/* Nút thêm cặp thẻ mới */
.btn-add-pair-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    border: 1.5px dashed #0f75bd;
    border-radius: 10px;
    background: #f0f9ff;
    color: #0f75bd;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    margin-top: 6px;
}
.btn-add-pair-action:hover:not(:disabled) {
    background: #e0f2fe;
    border-color: #0284c7;
    transform: translateY(-1px);
}
.btn-add-pair-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #cbd5e1;
    color: #94a3b8;
    background: #f8fafc;
}

/* ----------------------------------------------------
   FOOTER MODAL CÀI ĐẶT
   ---------------------------------------------------- */
.settings-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    flex-wrap: wrap;
    gap: 12px;
}

.settings-footer-left,
.settings-footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-tool-secondary {
    height: 38px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-tool-secondary:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.btn-tool-danger {
    color: #ef4444;
    border-color: #fecaca;
}
.btn-tool-danger:hover {
    background: #fee2e2;
    border-color: #ef4444;
}

.btn-tool-primary {
    height: 38px;
    padding: 0 22px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(234, 88, 12, 0.35);
    transition: all 0.2s;
}
.btn-tool-primary:hover {
    background: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(234, 88, 12, 0.45);
}

@media (max-width: 600px) {
    .settings-grid-2,
    .settings-grid-3 {
        grid-template-columns: 1fr;
    }
    .card-pair-body {
        flex-direction: column;
        align-items: stretch;
    }
    .pair-inputs-wrap {
        flex-direction: column;
    }
    .pair-inputs-wrap select {
        width: 100%;
    }
    .settings-footer {
        flex-direction: column;
        align-items: stretch;
    }
    .settings-footer-left,
    .settings-footer-right {
        justify-content: stretch;
    }
    .settings-footer-left button,
    .settings-footer-right button {
        flex: 1;
    }
}
