/* Submission Form Styles - Phase 5j */

.josha-form-container.josha-submission-form > h2 {
    display: none;
}

h1.wp-block-post-title {
    text-align: center;
}

/* Phase 5o: Validation Error Styles */
.josha-validation-errors {
    background: #fee;
    border: 1px solid #c33;
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.josha-validation-errors .error-title {
    margin: 0 0 0.5rem 0;
    color: #c33;
}

.josha-form-container.josha-submission-form {
    padding: 0;
    box-shadow: none;
}

.josha-validation-errors ul {
    margin: 0;
    padding-left: 1.5rem;
    color: #c33;
}

.josha-validation-errors li {
    margin-bottom: 0.25rem;
}

.has-error {
    border-color: #c33 !important;
    background-color: #fff5f5 !important;
}

.has-error input,
.has-error textarea,
.has-error select {
    border-color: #c33 !important;
}

/* Phase 5o: PDF Re-Upload Notice */
.josha-notice {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    border: 1px solid;
}

.josha-notice p {
    margin: 0;
}

.josha-notice p + p {
    margin-top: 0.5rem;
}

.josha-notice-info {
    background: #e7f3ff;
    border-color: #2196f3;
    color: #0d47a1;
}

.josha-notice-info strong {
    color: #0d47a1;
}

.josha-form-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.josha-form-section legend {
    font-size: 1.25rem;
    font-weight: 600;
    padding: 0 0.5rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row-2 > .form-field {
    flex: 1;
}

.form-field {
    margin-bottom: 1rem;
}

.form-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 6px;
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="tel"],
.form-field input[type="url"],
.form-field input[type="file"],
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

.form-field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.form-field input[type="file"] {
    display: block;
    width: 100%;
    padding: 1.25rem 1.5rem;
    border: 2px dashed #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    cursor: pointer;
    font-size: 0.875rem;
    color: #64748b;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.form-field input[type="file"]:hover {
    border-color: #ea580c;
    background: #fff7ed;
}

.form-field input[type="file"]:focus {
    outline: none;
    border-color: #ea580c;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.1);
}

.form-field input[type="file"]::file-selector-button {
    background: #ea580c;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.45rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    margin-right: 1rem;
    transition: background 0.2s ease;
    font-family: inherit;
}

.form-field input[type="file"]::file-selector-button:hover {
    background: #c2410c;
}

.form-field input[readonly],
.form-field input[disabled] {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

/* Extra spacing for picker fields */
.form-field:has(.josha-affiliation-picker),
.form-field:has(.josha-language-picker),
.form-field:has(.josha-tags-picker) {
    margin-top: 2.4em;
    margin-bottom: 2.4em;
}

/* Section separators */
.josha-section-header {
    margin-top: 4em;
    margin-bottom: 3em;
}

.josha-submitter-section .josha-section-header {
    margin-top: 0;
}

.josha-manuscript-source-section .form-field .field-hint,
.josha-featured-image-section .form-field .field-hint,
.josha-authors-section > .field-hint,
.form-field:has(.josha-affiliation-picker) .field-hint,
.form-field:has([data-taxonomy="categories"]) .field-hint {
    font-size: 12px;
    margin-top: 10px;
    margin-bottom: 0;
    background: #f9fafc;
    display: block;
    padding: 11px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    color: #64748b;
}

.josha-papers-section > .field-hint,
.josha-manuscript-source-section > .field-hint {
    font-size: 12px;
    margin-bottom: 20px;
    background: #f9fafc;
    display: inline-block;
    padding: 11px;
    border-radius: 12px;
}

.field-hint {
    font-size: 0.875rem;
    color: #666;
    margin-top: 0.25rem;
}

.required {
    color: #d00;
}

/* Authors Section */
#authors-container {
    margin-bottom: 1rem;
}

.author-row {
    position: relative;
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: #fff;
}

.author-row.dragging {
    opacity: 0.5;
    border-color: #0073aa;
}

.author-row-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.drag-handle {
    cursor: grab;
    font-size: 1.25rem;
    color: #6b7280;
    user-select: none;
    padding: 0.5rem;
    background: #f3f4f6;
    border-radius: 4px;
    letter-spacing: 2px;
    transition: all 0.2s ease;
}

.drag-handle:hover {
    background: #e5e7eb;
    color: #374151;
}

.drag-handle:active {
    cursor: grabbing;
    background: #d1d5db;
}

.author-number {
    font-weight: 600;
    flex: 1;
}

.corresponding-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.corresponding-toggle .josha-toggle-switch {
    width: 40px;
    height: 22px;
}

.corresponding-toggle .josha-toggle-switch::after {
    width: 16px;
    height: 16px;
}

.corresponding-toggle .josha-toggle-input:checked + .josha-toggle-switch::after {
    transform: translateX(18px);
}

.corresponding-toggle .josha-toggle-label {
    font-size: 0.9rem;
    color: #4b5563;
}

/* Visual "locked" state when only one author - still active but looks disabled */
.corresponding-toggle.is-locked .josha-toggle-switch {
    opacity: 0.6;
    cursor: not-allowed;
}

.corresponding-toggle.is-locked .josha-toggle-label {
    opacity: 0.6;
}

.remove-author-btn {
    background: transparent;
    color: #999;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    font-size: 0.8rem;
    margin-left: auto;
    transition: all 0.2s ease;
}

.remove-author-btn:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #dc2626;
}

.corresponding-required {
    display: none;
    color: #dc2626;
}

#add-author-btn {
    margin-top: 1rem;
}

/* Affiliation Picker */
.josha-affiliation-picker {
    position: relative;
}

.josha-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 24px;
    margin-bottom: 0.5rem;
}

.josha-tags-container:not(:has(> *)) {
    display: flex;
    align-items: center;
    min-height: 40px;
    border: 2px dashed #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
}

.josha-tags-container:not(:has(> *))::before {
    content: "None selected";
    font-size: 12px;
    color: #94a3b8;
    padding: 0 12px;
}

.josha-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background-color: #ea580c;
    color: #fff;
    border-radius: 3px;
    font-size: 0.875rem;
    line-height: 1.4;
}

.josha-tag-name {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.josha-tag-remove {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
    margin-left: 0.25rem;
}

.josha-tag-remove:hover {
    color: #f00;
}

.josha-affiliation-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    outline: none;
}

.josha-affiliation-input:focus,
.josha-language-input:focus,
.josha-tags-input:focus {
    border-color: #ea580c;
    box-shadow: 0 0 0 1px #ea580c;
}

/* Language Picker */
.josha-language-picker {
    position: relative;
}

.josha-main-language-field.is-hidden {
    display: none;
}

.josha-main-language-field select {
    width: 100%;
    padding: 0.75rem 0.85rem;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #fff;
    color: #1f2937;
}

.josha-main-language-field select:focus {
    outline: none;
    border-color: #ea580c;
    box-shadow: 0 0 0 1px #ea580c;
}

.josha-language-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    outline: none;
}

.josha-language-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.josha-language-dropdown.is-visible {
    display: block;
}

.josha-dropdown-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.josha-dropdown-item:last-child {
    border-bottom: none;
}

.josha-dropdown-item:hover {
    background: #f0f0f0;
}

.josha-dropdown-item.josha-no-results {
    color: #999;
    cursor: default;
}

.josha-dropdown-item.josha-no-results:hover {
    background: transparent;
}

/* Tags Picker (Keywords) Dropdown */
.josha-tags-picker {
    position: relative;
}

.josha-tags-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    outline: none;
}

/* focus for josha-tags-input merged above */

.josha-tags-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.josha-tags-dropdown-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.josha-tags-dropdown-item:last-child {
    border-bottom: none;
}

.josha-tags-dropdown-item:hover {
    background: #f0f0f0;
}

.josha-tags-dropdown-item.josha-no-results {
    color: #999;
    cursor: default;
}

.josha-tags-dropdown-item.josha-no-results:hover {
    background: transparent;
}

.josha-affiliation-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 100;
}

.josha-affiliation-dropdown.is-visible {
    display: block;
}

.josha-dropdown-item {
    padding: 0.5rem;
    cursor: pointer;
}

.josha-dropdown-item:hover {
    background: #f5f5f5;
}

.josha-dropdown-create {
    border-top: 1px solid #eee;
    color: #ea580c;
    font-weight: 500;
}

/* Modal */
.josha-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* ========================================
   Channel Selection Cards (Phase 5j J11.10)
   ======================================== */

.channel-toggle {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.channel-toggle label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 100px;
}

.channel-toggle label:hover {
    border-color: #9ca3af;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.channel-toggle input[type="radio"]:checked + .channel-option {
    color: #10b981;
}

.channel-toggle label:has(input:checked) {
    border-color: #10b981;
    background: #f0fdf4;
    position: relative;
}

.channel-toggle label:has(input:checked)::before {
    content: "✓";
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: #10b981;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
}

.channel-option {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 40px;
}

.channel-option strong {
    font-size: 1.1em;
    font-weight: 600;
}

.channel-option small {
    color: #6b7280;
    font-size: 0.9em;
    line-height: 1.4;
}

/* ========================================
   Modern Toggle Switch for Terms (Phase 5j J11.9)
   ======================================== */

.josha-toggle-field {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    margin-bottom: 12px;
}

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

.josha-toggle-switch {
    position: relative;
    flex-shrink: 0;
    width: 48px;
    height: 26px;
    background: #d1d5db;
    border-radius: 13px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.josha-toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.josha-toggle-input:checked + .josha-toggle-switch {
    background: #10b981;
}

.josha-toggle-input:checked + .josha-toggle-switch::after {
    transform: translateX(22px);
}

.josha-toggle-input:focus + .josha-toggle-switch {
    outline: 2px solid #ea580c;
    outline-offset: 2px;
}

.josha-toggle-label {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #374151;
}

.josha-toggle-field.has-error {
    border-color: #ef4444;
    background: #fef2f2;
}

/* ======================================== */

.josha-modal-content {
    background: #fff;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.josha-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.josha-modal-header h3 {
    margin: 0;
}

.josha-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
}

.josha-modal-close:hover {
    color: #000;
}

.josha-modal-body {
    padding: 1rem;
}

.josha-modal-intro {
    margin-bottom: 1rem;
    color: #666;
}

.josha-modal-field {
    margin-bottom: 1rem;
}

.josha-modal-field label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.josha-modal-field input,
.josha-modal-field select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.josha-modal-footer {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    padding: 1rem;
    border-top: 1px solid #eee;
}

.josha-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

.josha-btn-primary {
    background: #ea580c;
    color: #fff;
}

.josha-btn-primary:hover {
    background: #c2410c;
}

.josha-btn-secondary {
    background: #f5f5f5;
    color: #333;
}

.josha-btn-secondary:hover {
    background: #e5e5e5;
}

/* Phase 5l: ORCID-First UX */
.orcid-input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.orcid-input-group input {
    flex: 1;
}

.orcid-lookup-btn {
    padding: 8px 16px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
}

.orcid-lookup-btn:hover {
    background: #005a87;
}

.orcid-lookup-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.author-field-locked {
    opacity: 0.6;
    background-color: #f5f5f5 !important;
    cursor: not-allowed;
}

.orcid-message {
    margin-top: 0.5rem;
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.orcid-message.orcid-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.orcid-message.orcid-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.orcid-message.orcid-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.orcid-message.orcid-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.orcid-confirm-btn,
.orcid-no-orcid-btn {
    margin-top: 0.5rem;
    padding: 6px 12px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.orcid-confirm-btn:hover,
.orcid-no-orcid-btn:hover {
    background: #005a87;
}

/* ORCID-First UX: Initial state */
.orcid-first-field {
    margin-bottom: 1rem;
}

.orcid-first-field .orcid-input {
    width: 100%;
    max-width: 280px;
    font-family: monospace;
    font-size: 1rem;
    letter-spacing: 0.5px;
}

.orcid-skip-link {
    display: block;
    margin-top: 0.5rem;
    color: var(--wp--preset--color--primary);
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
}

.orcid-skip-link:hover {
    color: var(--wp--preset--color--primary);
    opacity: 0.8;
}

.orcid-restore-link {
    display: block;
    margin-bottom: 1rem;
    color: var(--wp--preset--color--primary);
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
}

.orcid-restore-link:hover {
    color: var(--wp--preset--color--primary);
    opacity: 0.8;
}

.orcid-status {
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.orcid-status:empty {
    display: none;
}

.orcid-result-message {
    margin-bottom: 1rem;
}

.orcid-result-message:empty {
    display: none;
}

/* Author details section animation */
.author-details-fields {
    animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Upload Preview Feedback */
.upload-preview {
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

.upload-preview .success {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: #16a34a;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
}

.upload-preview .error {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: #dc2626;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
}

/* Terms of Service / Author Agreement links */
.josha-toggle-label .josha-tos-link,
.josha-toggle-label .josha-author-agreement-link {
    color: #ea580c;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}

.josha-toggle-label .josha-tos-link:hover,
.josha-toggle-label .josha-author-agreement-link:hover {
    color: #c2410c;
}
