/**
 * R2R Research Submission Plugin - Frontend Styles
 * Version: 1.0.0
 * Cipher.co.th
 */

/* บังคับซ่อนเมื่อมี class hidden (ใช้กับ option รายละเอียดเมื่อเลือก "ไม่เคย") */
#r2r-submission-form .hidden {
    display: none !important;
}

/* ช่อง "อื่นๆ โปรดระบุ" อยู่แถวเดียวเต็มความกว้าง ไม่ดันฟิลด์อื่นตกบรรทัด */
#r2r-submission-form .r2r-other-row {
    width: 100%;
    flex-basis: 100%;
}
#r2r-submission-form .r2r-other-row input {
    max-width: 100%;
}

/* ========== Variables ========== */
:root {
    --r2r-primary: #2563eb;
    --r2r-primary-dark: #1d4ed8;
    --r2r-secondary: #64748b;
    --r2r-success: #22c55e;
    --r2r-warning: #f59e0b;
    --r2r-danger: #ef4444;
    --r2r-light: #f8fafc;
    --r2r-dark: #1e293b;
    --r2r-border: #e2e8f0;
    --r2r-radius: 8px;
    --r2r-radius-lg: 12px;
    --r2r-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    --r2r-shadow-card: 0 4px 12px rgba(0, 0, 0, 0.05);
    --r2r-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ========== Container ========== */
#r2r-submission-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background: #fff;
    border-radius: var(--r2r-radius-lg);
    border: 1px solid var(--r2r-border);
    box-shadow: var(--r2r-shadow-card);
    font-family: var(--r2r-font);
    color: var(--r2r-dark);
}

#r2r-submission-container::before {
    display: none;
}

#r2r-submission-form {
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.r2r-form-title {
    color: var(--r2r-dark) !important;
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    margin: 0 0 0.5rem 0 !important;
}

#r2r-submission-container .text-center.mb-8 p {
    color: var(--r2r-secondary) !important;
    font-size: 0.9375rem;
    margin: 0 !important;
}

/* ========== Step Tabs ========== */
.r2r-step-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 1.5rem;
    padding: 6px;
    background: var(--r2r-light);
    border-radius: var(--r2r-radius);
}

.r2r-tab {
    padding: 0.5rem 1rem;
    border-radius: var(--r2r-radius);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    background: transparent;
    color: var(--r2r-secondary);
    font-family: var(--r2r-font);
}

.r2r-tab:hover:not(.r2r-tab-locked) {
    background: #fff;
    color: var(--r2r-dark);
}

.r2r-tab.active {
    background: #fff;
    color: var(--r2r-primary);
    box-shadow: var(--r2r-shadow);
}

.r2r-tab-locked {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== Step Content ========== */
.r2r-step {
    display: none;
}

.r2r-step.active {
    display: block;
}

/* ========== Section Headings ========== */
.r2r-step h2:not(.r2r-heading-main) {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--r2r-dark);
    margin: 0 0 0.5rem 0;
}

.r2r-step .text-xl {
    font-size: 1.25rem !important;
}

.r2r-step .text-sm.text-gray-500,
.r2r-step .text-sm.text-gray-600 {
    color: var(--r2r-secondary) !important;
    margin-bottom: 1rem;
}

.r2r-form-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--r2r-border);
}

.r2r-form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.r2r-section-title,
.r2r-step h2.flex {
    font-size: 1.125rem !important;
    font-weight: 600 !important;
    color: var(--r2r-dark) !important;
    margin-bottom: 1rem !important;
}

/* ========== หัวข้อระดับ (Hierarchy) ========== */
/* หัวข้อหลัก: ส่วนที่ 1 / 2 / 3 — วงกลมเลข มีสีพื้นหลัง */
.r2r-heading-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--r2r-dark);
    margin: 0 0 1.5rem 0;
}
.r2r-heading-main .r2r-heading-main-num {
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    min-height: 2rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.r2r-heading-main[data-step="1"] .r2r-heading-main-num { background: var(--r2r-primary); }
.r2r-heading-main[data-step="2"] .r2r-heading-main-num { background: #16a34a; }
.r2r-heading-main[data-step="3"] .r2r-heading-main-num { background: #d97706; }

/* หัวข้อรอง: ระดับ 1.1 (h3 หรือ label แบบ X.Y) */
.r2r-heading-sub,
.r2r-step h3 {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--r2r-dark);
    margin: 0 0 0.75rem 0;
}
.r2r-label-sub {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--r2r-dark);
    margin-bottom: 0.35rem;
}

/* หัวข้อย่อย: ระดับ 3.2.1 (label แบบ X.Y.Z) */
.r2r-label-minor {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--r2r-dark);
    margin-bottom: 0.5rem;
}

/* ========== Form Grid ========== */
.r2r-step .grid {
    display: grid;
    gap: 1rem;
}

.r2r-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.r2r-form-grid .full-width,
.r2r-form-grid .md\:col-span-2 {
    grid-column: 1 / -1;
}

/* ========== Labels ========== */
.r2r-step label.block,
.r2r-form label.block {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--r2r-dark);
    margin-bottom: 0.25rem;
}

.r2r-step label .text-gray-700 {
    color: var(--r2r-dark) !important;
}

/* ========== Inputs ========== */
.r2r-step input[type="text"],
.r2r-step input[type="email"],
.r2r-step input[type="tel"],
.r2r-step input[type="number"],
.r2r-step textarea,
.r2r-step .r2r-disease-search-input,
.r2r-form input[type="text"],
.r2r-form input[type="email"],
.r2r-form input[type="tel"],
.r2r-form textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--r2r-border);
    border-radius: var(--r2r-radius);
    font-size: 0.9375rem;
    font-family: var(--r2r-font);
    color: var(--r2r-dark);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.r2r-step input::placeholder,
.r2r-step textarea::placeholder {
    color: #94a3b8;
}

.r2r-step input:focus,
.r2r-step textarea:focus,
.r2r-step .r2r-disease-search-input:focus,
.r2r-form input:focus,
.r2r-form textarea:focus {
    outline: none;
    border-color: var(--r2r-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.r2r-step input:disabled,
.r2r-step textarea:disabled,
.r2r-step .r2r-disease-search-input:disabled {
    background: var(--r2r-light);
    color: var(--r2r-secondary);
    cursor: not-allowed;
}

.r2r-step textarea {
    resize: vertical;
    min-height: 100px;
}

/* ========== Custom Select Trigger ========== */
.r2r-custom-select-trigger {
    width: 100%;
    padding: 0.5rem 0.75rem;
    padding-right: 2rem;
    border: 1px solid var(--r2r-border);
    border-radius: var(--r2r-radius);
    font-size: 0.9375rem;
    font-family: var(--r2r-font);
    background: #fff;
    cursor: pointer;
    text-align: left;
    color: var(--r2r-dark);
    transition: border-color 0.15s, box-shadow 0.15s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1.125rem;
}

.r2r-custom-select-trigger:hover:not(:disabled) {
    border-color: #cbd5e1;
}

.r2r-custom-select-trigger:focus {
    outline: none;
    border-color: var(--r2r-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.r2r-custom-select-trigger.placeholder {
    color: #94a3b8;
}

.r2r-custom-select-trigger.disabled,
.r2r-custom-select-trigger:disabled {
    background: var(--r2r-light);
    color: var(--r2r-secondary);
    cursor: not-allowed;
}

.r2r-custom-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 2px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    border: 1px solid var(--r2r-border);
    border-radius: var(--r2r-radius);
    box-shadow: var(--r2r-shadow-card);
    background: #fff;
}

.r2r-custom-select-dropdown.open {
    display: block;
}

.r2r-disease-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 2px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
    border: 1px solid var(--r2r-border);
    border-radius: var(--r2r-radius);
    box-shadow: var(--r2r-shadow-card);
    background: #fff;
}

.r2r-custom-select-item,
.r2r-disease-dropdown .r2r-disease-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem;
    border-bottom: 1px solid var(--r2r-border);
}

.r2r-custom-select-item:last-child,
.r2r-disease-dropdown .r2r-disease-item:last-child {
    border-bottom: none;
}

.r2r-custom-select-item:hover,
.r2r-custom-select-item:focus,
.r2r-disease-dropdown .r2r-disease-item:hover,
.r2r-disease-dropdown .r2r-disease-item:focus {
    background: var(--r2r-light);
    outline: none;
}

.r2r-disease-dropdown .r2r-disease-more {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--r2r-secondary);
    background: var(--r2r-light);
}

.r2r-disease-search-wrap,
.r2r-custom-select-wrap {
    position: relative;
}

.r2r-disease-select-hidden,
.r2r-custom-select-hidden {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* โหมดดูอย่างเดียว: dropdown ไม่ให้กดเลือกได้ */
.r2r-form-view-only .r2r-custom-select-trigger,
.r2r-form-view-only .r2r-custom-select-wrap.r2r-select-readonly .r2r-custom-select-trigger {
    pointer-events: none;
    cursor: default;
    background: var(--r2r-light);
}
.r2r-form-view-only .r2r-custom-select-dropdown,
.r2r-form-view-only .r2r-custom-select-wrap .r2r-custom-select-dropdown {
    display: none !important;
}

/* ========== Buttons ========== */
.r2r-step button[type="button"].r2r-next-step,
.r2r-step button.r2r-next-step,
.r2r-step .bg-blue-600 {
    padding: 0.5rem 1.25rem;
    border-radius: var(--r2r-radius);
    font-size: 0.9375rem;
    font-weight: 500;
    font-family: var(--r2r-font);
    background: var(--r2r-primary) !important;
    color: #fff !important;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}

.r2r-step button.r2r-next-step:hover:not(:disabled),
.r2r-step .bg-blue-600:hover {
    background: var(--r2r-primary-dark) !important;
}

.r2r-step button.r2r-next-step:disabled,
.r2r-step .bg-blue-600:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== Validation: เตือนแค่ข้อความ ========== */
.r2r-field-warning {
    display: block;
    font-size: 0.75rem;
    color: #b91c1c;
    margin-top: 2px;
    margin-bottom: 0;
}
.r2r-field-warning::before {
    content: "⚠ ";
}

.r2r-save-draft-btn,
.r2r-step button.border-2 {
    padding: 0.5rem 1.25rem;
    border-radius: var(--r2r-radius);
    font-size: 0.9375rem;
    font-weight: 500;
    font-family: var(--r2r-font);
    background: #fff !important;
    color: var(--r2r-dark) !important;
    border: 1px solid var(--r2r-border) !important;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.r2r-save-draft-btn:hover,
.r2r-step button.border-2:hover {
    border-color: #cbd5e1 !important;
    background: var(--r2r-light) !important;
}

.r2r-step button.bg-gradient-to-r {
    background: var(--r2r-primary) !important;
    color: #fff !important;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: var(--r2r-radius);
    font-weight: 500;
}

.r2r-step button.bg-gradient-to-r:hover {
    background: var(--r2r-primary-dark) !important;
}

/* ========== Step 0 Checklist ========== */
.r2r-step ul.space-y-4 li,
.r2r-check-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--r2r-light);
    border-radius: var(--r2r-radius);
    margin-bottom: 0.5rem;
    border: 1px solid var(--r2r-border);
}

.r2r-step ul.space-y-4 li:last-child,
.r2r-check-item:last-child {
    margin-bottom: 0;
}

.r2r-step ul.space-y-4 li .font-medium,
.r2r-check-label {
    font-weight: 500;
    color: var(--r2r-dark);
    flex: 1;
    min-width: 180px;
    font-size: 0.9375rem;
}

.r2r-step ul.space-y-4 li label,
.r2r-check-options label {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--r2r-secondary);
}

.r2r-step ul.space-y-4 li input[type="radio"] {
    accent-color: var(--r2r-primary);
}

.r2r-step ul.space-y-4 li input[type="file"] {
    font-size: 0.8125rem;
    padding: 0.25rem 0;
}

.r2r-step ul.space-y-4 .text-gray-500 {
    color: var(--r2r-secondary) !important;
}

/* ========== Footer ========== */
.r2r-step .border-t {
    border-top: 1px solid var(--r2r-border) !important;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
}

.r2r-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--r2r-border);
}

.r2r-form-footer-right {
    display: flex;
    gap: 0.5rem;
}

/* ========== Toast ========== */
#r2r-form-message {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 9999;
    padding: 0.75rem 1rem;
    border-radius: var(--r2r-radius);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--r2r-font);
    max-width: 320px;
    border: 1px solid var(--r2r-border);
    box-shadow: var(--r2r-shadow-card);
    transform: translateY(-6px);
    opacity: 0;
    transition: transform 0.2s, opacity 0.2s;
}

#r2r-form-message.show {
    transform: translateY(0);
    opacity: 1;
}

#r2r-form-message.success {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

#r2r-form-message.error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

/* ========== Co-researcher Cards ========== */
.coresearcher-item {
    padding: 1rem !important;
    background: var(--r2r-light) !important;
    border: 1px solid var(--r2r-border) !important;
    border-radius: var(--r2r-radius) !important;
}

.coresearcher-item .cr-role,
.coresearcher-item .cr-gender,
.coresearcher-item .cr-prefix-select,
.coresearcher-item input {
    border-radius: var(--r2r-radius) !important;
    border-color: var(--r2r-border) !important;
    font-size: 0.875rem !important;
}

/* ========== Agreement / Notice ========== */
.r2r-step .bg-amber-50 {
    background: #fffbeb !important;
    border: 1px solid #fde68a;
    border-radius: var(--r2r-radius);
    padding: 1rem;
}

.r2r-step .bg-amber-50 .text-sm {
    color: var(--r2r-dark) !important;
}

/* ========== Checkboxes & Radio (minimal: no bg, 1rem) ========== */
#r2r-submission-form input[type="checkbox"],
#r2r-submission-form input[type="radio"],
.r2r-step input[type="checkbox"],
.r2r-step input[type="radio"],
.r2r-form input[type="checkbox"],
.r2r-form input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1rem;
    height: 1rem;
    margin: 0;
    flex-shrink: 0;
    border: 1px solid var(--r2r-border);
    background: transparent;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    vertical-align: middle;
}
#r2r-submission-form input[type="checkbox"],
.r2r-step input[type="checkbox"],
.r2r-form input[type="checkbox"] {
    border-radius: 3px;
}
#r2r-submission-form input[type="radio"],
.r2r-step input[type="radio"],
.r2r-form input[type="radio"] {
    border-radius: 50%;
}
#r2r-submission-form input[type="checkbox"]:focus,
#r2r-submission-form input[type="radio"]:focus,
.r2r-step input[type="checkbox"]:focus,
.r2r-step input[type="radio"]:focus,
.r2r-form input[type="checkbox"]:focus,
.r2r-form input[type="radio"]:focus {
    outline: none;
    border-color: var(--r2r-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
/* Checkbox checked: เฉพาะขอบ + เครื่องหมายถูก ไม่มีพื้นหลัง */
#r2r-submission-form input[type="checkbox"]:checked,
.r2r-step input[type="checkbox"]:checked,
.r2r-form input[type="checkbox"]:checked {
    background: transparent;
    border-color: var(--r2r-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: 100% 100%;
}
/* Radio checked: จุดเล็กกลาง ไม่มีพื้นหลัง */
#r2r-submission-form input[type="radio"]:checked,
.r2r-step input[type="radio"]:checked,
.r2r-form input[type="radio"]:checked {
    background: transparent;
    border-color: var(--r2r-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%232563eb'%3E%3Ccircle cx='12' cy='12' r='5'%3E%3C/circle%3E%3C/svg%3E");
    background-size: 100% 100%;
}
/* Label คู่ checkbox/radio: ไม่มีพื้นหลัง */
#r2r-submission-form label:has(input[type="checkbox"]),
#r2r-submission-form label:has(input[type="radio"]),
.r2r-step label:has(input[type="checkbox"]),
.r2r-step label:has(input[type="radio"]),
.r2r-form label:has(input[type="checkbox"]),
.r2r-form label:has(input[type="radio"]) {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9375rem;
    color: var(--r2r-dark);
    background: none;
}

/* กลุ่มเป้าหมาย / ประเด็นย่อย: สองคอลัมน์เรียงเป็นระเบียบ ไม่มีพื้นหลัง */
.r2r-checkbox-two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 2rem;
    align-content: start;
}
.r2r-checkbox-two-cols .r2r-checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
    margin: 0;
    background: none !important;
    font-size: 0.9375rem;
    color: var(--r2r-dark);
    cursor: pointer;
    min-height: 1.5rem;
}
.r2r-checkbox-two-cols .r2r-checkbox-row:hover {
    background: none !important;
}
@media (max-width: 640px) {
    .r2r-checkbox-two-cols {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
}

.r2r-step .r2r-subissue-other-cb {
    accent-color: var(--r2r-primary);
}

.r2r-step label.flex.items-center.gap-2 {
    font-size: 0.875rem;
    color: var(--r2r-dark);
}

/* ========== Add Co-researcher ========== */
#btn-add-coresearcher {
    padding: 0.5rem 1rem !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    background: #fff !important;
    color: var(--r2r-dark) !important;
    border: 1px solid var(--r2r-border) !important;
    border-radius: var(--r2r-radius) !important;
}

#btn-add-coresearcher:hover {
    border-color: #cbd5e1 !important;
    background: var(--r2r-light) !important;
}

/* ปุ่มเลือกไฟล์ (ตรวจสอบผลงาน) — สไตล์เดียวกับปุ่มเพิ่มนักวิจัย */
.r2r-file-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.r2r-file-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--r2r-font);
    background: #fff;
    color: var(--r2r-dark);
    border: 1px solid var(--r2r-border);
    border-radius: var(--r2r-radius);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.r2r-file-btn:hover {
    border-color: #cbd5e1;
    background: var(--r2r-light);
}
.r2r-file-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}
/* ตรวจสอบผลงาน: แถวแรก = คำถาม + (แนบไฟล์) + radio ใช่/ไม่ใช่ ด้านหลัง, แถวสอง = ปุ่มอัพโหลด + ชื่อไฟล์ ด้านล่าง */
.r2r-check-li-file {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.r2r-check-li-file .r2r-check-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
}
.r2r-check-li-file .r2r-check-question {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
}
.r2r-check-li-file .r2r-check-radios {
    flex-shrink: 0;
    margin-left: auto;
}
.r2r-check-li-file .r2r-file-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    width: 100%;
    margin-top: 0.25rem;
}
.r2r-check-li-file .r2r-file-name {
    font-size: 0.8125rem;
    color: var(--r2r-secondary);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.r2r-check-li-file .r2r-file-link {
    font-size: 0.875rem;
    color: var(--r2r-primary);
    text-decoration: none;
}
.r2r-check-li-file .r2r-file-link:hover {
    text-decoration: underline;
}

/* ข้อ 1–2 แบบเดียวกับข้อ 3–6; ปุ่มอัพโหลดแสดงเมื่อเลือก "ใช่" */
.r2r-check-li-optional-file .r2r-file-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.r2r-check-li-optional-file .r2r-file-name {
    font-size: 0.8125rem;
    color: var(--r2r-secondary);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.r2r-check-li-optional-file .r2r-file-link {
    font-size: 0.875rem;
    color: var(--r2r-primary);
    text-decoration: none;
}
.r2r-check-li-optional-file .r2r-file-link:hover {
    text-decoration: underline;
}

/* ระยะห่างระหว่าง radio ใช่ / ไม่ใช่ */
.r2r-check-radios {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* ข้อ 3–6 ไม่แนบไฟล์: ข้อความชิดซ้าย, radio ใช่/ไม่ใช่ ด้านขวา */
.r2r-check-li-no-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.r2r-check-li-no-file .r2r-check-question {
    text-align: left;
    flex: 1 1 auto;
    min-width: 0;
}
.r2r-check-li-no-file .r2r-check-radios {
    flex-shrink: 0;
}

.r2r-step a {
    color: var(--r2r-primary);
    text-decoration: none;
}

.r2r-step a:hover {
    text-decoration: underline;
}

/* ========== Other Shortcodes ========== */
.r2r-form-wrapper,
.r2r-submissions-wrapper,
/* ========== หน้า Finalist อัพโหลด PDF (Redesign) ========== */
.r2r-finalist-page {
    min-height: 60vh;
    padding: 2rem 1rem;
    font-family: var(--r2r-font, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}
.r2r-finalist-card {
    max-width: 560px;
    margin: 0 auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.06);
    overflow: hidden;
}
.r2r-finalist-header {
    padding: 2rem 2rem 1.5rem;
    text-align: center;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: #fff;
}
.r2r-finalist-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.25);
    margin-bottom: 0.75rem;
}
.r2r-finalist-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
}
.r2r-finalist-project {
    font-size: 0.9375rem;
    opacity: 0.95;
    margin: 0;
}
.r2r-finalist-instructions {
    padding: 1.5rem 2rem 0;
}
.r2r-finalist-instructions-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 0.75rem 0;
}
.r2r-finalist-instructions-list {
    margin: 0;
    padding-left: 1.25rem;
    color: #475569;
    font-size: 0.9375rem;
    line-height: 1.7;
}
.r2r-finalist-instructions-list li {
    margin-bottom: 0.35rem;
}
.r2r-finalist-notice {
    margin: 1.25rem 2rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
}
.r2r-finalist-notice-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}
.r2r-finalist-notice-title {
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}
.r2r-finalist-notice-hint {
    font-size: 0.8125rem;
    color: #047857;
    margin: 0.5rem 0 0 0;
}
.r2r-finalist-form {
    padding: 1.5rem 2rem 2rem;
}
.r2r-finalist-confirm-wrap {
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 10px;
}
.r2r-finalist-confirm-notice {
    margin: 0 0 0.75rem 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #92400e;
}
.r2r-finalist-confirm-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    color: #78350f;
    cursor: pointer;
}
.r2r-finalist-confirm-checkbox {
    width: 1.125rem;
    height: 1.125rem;
    cursor: pointer;
}
.r2r-finalist-field {
    margin-bottom: 1.25rem;
}
.r2r-finalist-label {
    display: block;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #334155;
    margin-bottom: 0.5rem;
}
.r2r-finalist-file-wrap {
    margin-top: 0.25rem;
}
.r2r-finalist-file-input {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.r2r-finalist-file-input:hover {
    border-color: #0ea5e9;
    background: #f0f9ff;
}
.r2r-finalist-file-wrap .r2r-file-preview {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #64748b;
}
.r2r-finalist-actions {
    margin-top: 1.5rem;
}
.r2r-finalist-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}
.r2r-finalist-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}
.r2r-finalist-btn-primary {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.35);
}
.r2r-finalist-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    transform: translateY(-1px);
}
.r2r-finalist-btn-secondary {
    background: #fff;
    color: #0284c7;
    border: 2px solid #0ea5e9;
    text-decoration: none;
}
.r2r-finalist-btn-secondary:hover {
    background: #f0f9ff;
}
.r2r-finalist-back-profile {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e2e8f0;
}
.r2r-finalist-btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: #f8fafc;
    color: #475569;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.r2r-finalist-btn-back:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #334155;
}
.r2r-finalist-message {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.9375rem;
}
.r2r-finalist-message-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.r2r-finalist-message-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}
.r2r-finalist-progress {
    margin-top: 1rem;
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}
.r2r-finalist-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0ea5e9, #0284c7);
    border-radius: 999px;
    transition: width 0.2s ease;
}

.r2r-upload-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    background: #fff;
    border-radius: var(--r2r-radius-lg);
    border: 1px solid var(--r2r-border);
    box-shadow: var(--r2r-shadow-card);
    font-family: var(--r2r-font);
}

.r2r-form-header h2,
.r2r-submissions-header h2,
.r2r-upload-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--r2r-dark);
    margin: 0 0 0.5rem 0;
}

.r2r-form-subtitle,
.r2r-upload-subtitle {
    color: var(--r2r-secondary);
    font-size: 0.9375rem;
}

.r2r-btn-primary {
    background: var(--r2r-primary);
    color: #fff;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: var(--r2r-radius);
    font-weight: 500;
}

.r2r-btn-primary:hover {
    background: var(--r2r-primary-dark);
}

.r2r-btn-secondary {
    background: #fff;
    color: var(--r2r-dark);
    border: 1px solid var(--r2r-border);
}

.r2r-btn-secondary:hover {
    background: var(--r2r-light);
}

.r2r-submissions-table th,
.r2r-submissions-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--r2r-border);
    font-size: 0.9375rem;
}

.r2r-submissions-table th {
    background: var(--r2r-light);
    font-weight: 500;
    color: var(--r2r-secondary);
}

.r2r-submissions-table tbody tr:hover {
    background: var(--r2r-light);
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    #r2r-submission-container {
        margin: 1rem;
        padding: 1.25rem;
    }

    .r2r-form-grid {
        grid-template-columns: 1fr;
    }

    .r2r-form-grid .full-width,
    .r2r-form-grid .md\:col-span-2 {
        grid-column: 1;
    }

    .r2r-step-tabs {
        margin-bottom: 1.25rem;
    }

    .r2r-tab {
        font-size: 0.8125rem;
        padding: 0.45rem 0.75rem;
    }

    .r2r-form-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .r2r-form-footer-right {
        justify-content: flex-end;
    }
}
