/* Profile & job create/edit forms + section dialogs — mobile only (≤600px). Desktop unchanged. */

@media (max-width: 600px) {
    .mud-layout .mud-main-content:has(.profile-edit-page),
    .mud-layout .mud-main-content:has(.profile-section-mobile-page) {
        background-color: #ffffff !important;
        padding-top: 76px !important;
    }

    .mud-layout .mud-main-content:has(.profile-edit-page) > .mud-container {
        padding-left: 0 !important;
        padding-right: 0 !important;
        max-width: 100% !important;
    }

    .profile-edit-page.job-form-container {
        background: #ffffff;
        padding: 0 16px 32px;
        min-height: calc(100vh - 64px);
        position: relative;
        z-index: 1;
    }

    .profile-edit-page .job-form-card {
        max-width: 100%;
        margin: 0;
        padding: 0;
        border-radius: 0;
        box-shadow: none;
        background: #ffffff;
    }

    .profile-edit-page .form-title {
        font-size: 1.25rem;
        margin-bottom: 2px;
    }

    .profile-edit-page .form-subtitle {
        font-size: 13px;
        margin-bottom: 20px;
    }

    .profile-edit-page .form-section {
        margin-bottom: 20px;
    }

    .profile-edit-page .field-half,
    .profile-edit-page .mud-grid .mud-grid-item {
        flex: 1 1 100%;
        min-width: 0;
        max-width: 100%;
    }

    .profile-form-section-title {
        font-weight: 700;
        font-size: 1rem;
        text-align: right;
        color: #1a202c;
        margin-bottom: 4px;
    }

    .profile-form-section-hint {
        color: #7f8fa4;
        font-size: 12px;
        text-align: right;
        margin-bottom: 0;
    }

    .profile-edit-page .job-form-field-below-add {
        width: 100%;
        margin-top: 8px;
    }

    .profile-edit-page .job-form-field-below-add .mud-input-control {
        width: 100% !important;
    }

    .profile-edit-page .profile-edit-back.mobile-top-actions {
        display: flex !important;
        justify-content: flex-start;
        align-items: center;
        width: 100%;
        margin-bottom: 12px;
        padding: 8px 0;
        position: relative;
        z-index: 10;
        pointer-events: auto;
        direction: rtl;
    }

    .profile-edit-back .profile-back-link-btn .mud-button-label {
        justify-content: flex-start;
    }

    .profile-edit-back .profile-back-link-btn,
    .profile-edit-back .profile-back-link-btn .mud-button-label,
    .profile-edit-back .profile-back-link-btn .mud-icon-root {
        color: #3B82F6 !important;
        text-transform: none;
        font-size: 14px;
        font-weight: 600;
    }

    .profile-edit-back .profile-back-link-btn {
        min-height: 44px;
        padding: 8px 4px;
        pointer-events: auto !important;
    }

    /* Full-page add sections (portfolio / video / certification) */
    .profile-section-mobile-page {
        display: flex;
        flex-direction: column;
        min-height: calc(100vh - 64px);
        background: #ffffff;
        padding: 12px 16px 24px;
    }

    .profile-section-mobile-header {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 16px;
        flex-direction: row-reverse;
        justify-content: flex-end;
    }

    .profile-section-mobile-title {
        font-weight: 700;
        font-size: 1.125rem;
        color: #1a202c;
        flex: 1;
        text-align: right;
    }

    .profile-section-mobile-close {
        color: #6b7280 !important;
    }

    .profile-section-mobile-body {
        flex: 1 1 auto;
        overflow-y: auto;
        padding-bottom: 16px;
    }

    .profile-section-mobile-footer {
        flex-shrink: 0;
        margin-top: auto;
        padding-top: 16px;
    }

    .profile-section-mobile-page .portfolio-upload-dropzone {
        display: flex !important;
    }

    .profile-form-actions {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding-top: 24px !important;
        width: 100%;
    }

    .profile-form-actions .mud-button-root {
        flex: 1 1 auto;
        min-width: 0;
        max-width: 48%;
    }

    .profile-edit-page .publish-btn {
        background-color: #3B82F6 !important;
        color: #ffffff !important;
    }

    .profile-form-actions .publish-btn {
        width: auto;
        flex: 1 1 auto;
        max-width: none;
    }

    .profile-edit-page .job-form-input-theme .mud-input-outlined.mud-input-focused:not(.mud-input-disabled) .mud-input-outlined-border,
    .profile-edit-page .job-form-input-theme .mud-input-control:focus-within:not(.mud-input-disabled) .mud-input-outlined .mud-input-outlined-border {
        border-color: #3B82F6 !important;
    }

    /* Portfolio / video / certs — title + hint, then Add on next line (right-aligned, RTL) */
    .profile-form-add-block {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        margin-bottom: 12px;
        direction: rtl;
        width: 100%;
    }

    .profile-form-add-text {
        width: 100%;
        text-align: right;
    }

    .profile-form-add-block .profile-form-section-title {
        margin-bottom: 2px;
    }

    .profile-form-add-block .profile-form-section-hint {
        margin-bottom: 8px;
    }

    .profile-form-add-block .btn-add-inline {
        align-self: flex-start;
        margin: 0 !important;
        min-width: 80px;
        height: 40px;
        border-color: #3B82F6 !important;
        color: #3B82F6 !important;
        background: #ffffff !important;
        font-size: 14px;
        font-weight: 600;
        box-shadow: none;
        border-radius: 8px;
    }

    .profile-form-add-block .btn-add-inline .mud-icon-root {
        display: none;
    }

    /* Full-screen section dialogs (portfolio, video, certs) */
    .mud-dialog-container.profile-section-dialog {
        align-items: stretch !important;
        justify-content: stretch !important;
        padding: 0 !important;
    }

    .mud-dialog-container.profile-section-dialog .mud-dialog {
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        display: flex;
        flex-direction: column;
    }

    .mud-dialog-container.profile-section-dialog .mud-dialog-content {
        flex: 1 1 auto;
        max-height: none !important;
        overflow-y: auto !important;
        padding: 16px !important;
    }

    .mud-dialog-container.profile-section-dialog .mud-dialog-title {
        padding: 12px 16px 8px !important;
        border-bottom: 1px solid #f1f5f9;
    }

    .mud-dialog-container.profile-section-dialog .profile-dialog-title {
        font-size: 1.125rem;
        padding-right: 40px;
    }

    .mud-dialog-container.profile-section-dialog .mud-dialog-actions {
        flex-shrink: 0;
        border-top: 1px solid #f1f5f9;
        padding: 12px 16px 20px !important;
        margin: 0 !important;
    }

    .profile-dialog-actions {
        flex-direction: row !important;
        justify-content: space-between !important;
        width: 100%;
        gap: 12px !important;
    }

    .profile-dialog-actions .mud-button-root {
        flex: 1 1 0;
        width: auto !important;
        min-width: 0 !important;
        max-width: 48%;
    }

    .profile-dialog-actions .mud-button-filled-primary,
    .profile-section-mobile-footer .mud-button-filled-primary {
        flex: 1 1 auto;
        background-color: #3B82F6 !important;
    }

    /* Portfolio upload dropzone (mockup) */
    .portfolio-upload-dropzone {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        min-height: 160px;
        border: 2px dashed #3B82F6;
        border-radius: 12px;
        background: #f8fafc;
        color: #3B82F6;
        cursor: pointer;
        margin-top: 8px;
    }

    .portfolio-upload-dropzone .mud-icon-root {
        font-size: 2rem;
    }

    .portfolio-upload-dropzone-label {
        font-weight: 600;
        font-size: 15px;
    }

    .portfolio-dialog-desktop-upload {
        display: none !important;
    }

    .portfolio-upload-previews {
        margin-top: 12px;
    }

    /* Job create: use same section labels as desktop */
    .job-create-page .job-docs-section .job-section-label-mobile,
    .job-create-page .job-video-section .job-section-label-mobile {
        display: none !important;
    }

    .job-create-page .job-docs-section .job-docs-label-desktop,
    .job-create-page .job-video-section .job-video-label-desktop {
        display: block !important;
    }

    .profile-edit-page .btn-add {
        text-transform: none;
        border-color: #3B82F6 !important;
        color: #3B82F6 !important;
    }

    /* Create job — bilingual labels (EN on mobile, HE on desktop) */
    .job-create-page .job-label-en,
    .job-create-page .job-hint-en {
        display: inline;
    }

    .job-create-page .job-label-he,
    .job-create-page .job-hint-he {
        display: none;
    }

    .job-create-page .job-section-label-mobile {
        display: flex !important;
        align-items: center;
        gap: 6px;
        margin-bottom: 8px;
    }

    .job-create-page .job-desc-edit-desktop {
        display: none !important;
    }

    .job-create-page.job-is-new .job-desc-slot-preview {
        display: none !important;
    }

    .job-create-page.job-is-new .job-desc-editor-layer {
        opacity: 1 !important;
        pointer-events: auto !important;
        position: relative !important;
    }

    .job-create-page .job-category-desktop-trigger {
        display: none !important;
    }

    .job-create-page .job-category-mobile-row {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 10px;
        direction: ltr;
        width: 100%;
    }

    .job-create-page .job-category-mobile-row .job-add-inline-btn,
    .job-create-page .job-category-mobile-row .btn-add-inline {
        flex: 0 0 auto;
        min-width: 72px;
        max-width: 88px;
        margin: 0 !important;
        align-self: center;
    }

    .job-create-page .job-category-summary-field {
        flex: 1 1 0;
        min-width: 0;
        width: auto !important;
        cursor: pointer;
    }

    .job-create-page .job-category-summary-field .mud-input-control {
        width: 100% !important;
    }

    /* Job docs / video — same row as desktop: input on the right, Add on the left (RTL) */
    .job-create-page .job-docs-section .job-add-inline-row,
    .job-create-page .job-video-section .job-add-inline-row {
        display: block !important;
        width: 100%;
    }

    .job-create-page .job-docs-section .profile-form-add-block,
    .job-create-page .job-video-section .profile-form-add-block {
        display: flex !important;
        flex-direction: row-reverse !important;
        flex-wrap: wrap !important;
        align-items: flex-start !important;
        gap: 8px;
        direction: rtl;
        width: 100%;
        margin-bottom: 0;
    }

    .job-create-page .job-docs-section .profile-form-add-text,
    .job-create-page .job-video-section .profile-form-add-text {
        display: none !important;
    }

    .job-create-page .job-add-inline-upload {
        flex: 0 0 auto;
        width: auto !important;
        display: block;
    }

    .job-create-page .job-add-inline-btn,
    .job-create-page .job-docs-section .profile-form-add-block .btn-add-inline,
    .job-create-page .job-video-section .profile-form-add-block .btn-add-inline,
    .job-create-page .job-category-mobile-row .btn-add-inline {
        flex: 0 0 auto;
        min-width: 72px;
        max-width: 88px;
        margin: 0 !important;
        align-self: flex-start !important;
    }

    .job-create-page .job-docs-section .job-inline-field,
    .job-create-page .job-docs-section .job-form-field-below-add,
    .job-create-page .job-video-section .job-inline-field,
    .job-create-page .job-video-section .job-form-field-below-add {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        width: auto !important;
        margin-top: 0 !important;
        display: block !important;
    }

    .job-create-page .job-docs-section .job-inline-field .mud-input-control,
    .job-create-page .job-docs-section .job-form-field-below-add .mud-input-control,
    .job-create-page .job-video-section .job-inline-field .mud-input-control,
    .job-create-page .job-video-section .job-form-field-below-add .mud-input-control {
        width: 100% !important;
    }

    .job-create-page .job-form-footer.profile-form-actions {
        justify-content: flex-end !important;
        flex-wrap: nowrap;
        gap: 12px;
    }

    .job-create-page .job-form-footer .mud-button-root {
        flex: 0 0 auto !important;
        max-width: none !important;
        width: auto !important;
        min-width: 0;
    }

    .job-create-page .job-form-footer .mud-button-outlined {
        min-width: 96px;
        padding-left: 16px;
        padding-right: 16px;
    }

    .job-create-page .job-form-footer .publish-btn {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 132px;
        max-width: 52%;
        padding: 10px 22px;
    }
}

@media (min-width: 601px) {
    .job-create-page .job-label-en,
    .job-create-page .job-hint-en {
        display: none;
    }

    .job-create-page .job-label-he,
    .job-create-page .job-hint-he {
        display: inline;
    }

    .job-create-page .job-section-label-mobile {
        display: none !important;
    }

    .job-create-page .job-category-mobile-row {
        display: none !important;
    }

    .job-create-page .job-category-desktop-trigger {
        display: block !important;
    }

    .job-create-page .job-add-inline-row {
        display: block;
    }

    .profile-edit-page .profile-edit-back.mobile-top-actions {
        display: none !important;
    }

    .portfolio-upload-dropzone,
    .portfolio-upload-previews-only-mobile {
        display: none !important;
    }

    .profile-form-add-block {
        display: block;
    }

    .profile-form-add-block .btn-add-inline {
        margin-top: 8px;
        margin-bottom: 12px !important;
    }

    /* Job form: restore desktop inline layout for docs / video */
    .job-docs-section .profile-form-add-text,
    .job-video-section .profile-form-add-text {
        display: none !important;
    }

    .job-docs-section .job-docs-label-desktop,
    .job-video-section .job-video-label-desktop {
        display: block !important;
    }

    .job-docs-section .profile-form-add-block,
    .job-video-section .profile-form-add-block {
        display: flex !important;
        flex-direction: row-reverse !important;
        flex-wrap: wrap !important;
        align-items: flex-start !important;
        gap: 8px;
        direction: rtl;
        margin-bottom: 0;
    }

    .job-docs-section .profile-form-add-block .btn-add-inline,
    .job-video-section .profile-form-add-block .btn-add-inline {
        align-self: auto !important;
        margin: 0 !important;
    }

    .job-docs-section .job-form-field-below-add,
    .job-video-section .job-form-field-below-add {
        flex: 1 1 200px !important;
        min-width: 200px !important;
        margin-top: 0 !important;
    }

    /* Video URL field: align to the right on desktop (RTL) */
    .job-video-section .profile-form-add-block {
        justify-content: flex-start;
    }

    .job-video-section .job-form-field-below-add input,
    .job-video-section .job-form-field-below-add .mud-input-slot,
    .job-video-section .job-form-field-below-add textarea,
    .job-video-section .job-inline-field input,
    .job-video-section .job-inline-field .mud-input-slot {
        text-align: right !important;
        direction: ltr;
    }
}
