/* 
 * Meta Doctors Form - Styles
 * Prefixed with md-form-wrapper to avoid conflicts with WordPress themes
 * All selectors are scoped to .md-form-wrapper
 */

/* Reset e Variáveis - Escopado ao wrapper */
.md-form-wrapper {
    --md-primary-dark: #27364a;
    --md-primary-blue: #0000ff;
    --md-bg-light-blue: #e8f1ff;
    --md-white: #ffffff;
    --md-black: #1a1a1a;
    --md-border-color: #e8e8e8;
    --md-text-secondary: rgba(26, 26, 26, 0.4);
    --md-text-hint: rgba(39, 54, 74, 0.7);
    
    font-family: 'Inter', sans-serif;
    /* background-color: var(--md-bg-light-blue); */
    color: var(--md-primary-dark);
    line-height: 1.5;
    padding: clamp(20px, 3vw, 35px) clamp(20px, 10vw, 138px);
    min-height: 100vh;
    box-sizing: border-box;
}

.md-form-wrapper *,
.md-form-wrapper *::before,
.md-form-wrapper *::after {
    box-sizing: border-box;
}

.md-form-container {
    max-width: 100% !important;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 35px;
}

#formulario-medicos {
    display: flex;
    flex-direction: column;
    gap: 40px;
    margin-top: 70px;
}

/* Header */
.md-form-wrapper .header,
.md-form-wrapper .md-form-header {
    position: relative;
    height: 127px;
    background: linear-gradient(to right, #040128, #7a1af9);
    border-radius: 16px;
    display: flex;
    align-items: center;
    padding: 0 35px;
    overflow: hidden;
}

.md-form-wrapper .header-title,
.md-form-wrapper .md-form-header-title {
    font-size: 36px;
    font-weight: 700;
    color: var(--md-white);
    margin: 0;
}

.md-form-wrapper .header-decoration,
.md-form-wrapper .md-form-header-decoration {
    position: absolute;
    right: clamp(20px, 8vw, 104px);
    top: 7px;
    width: clamp(100px, 15vw, 181px);
    height: clamp(150px, 20vw, 253px);
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="181" height="253" viewBox="0 0 181 253" fill="none"><path d="M90.5 0L181 63.25V190.5L90.5 253L0 190.5V63.25L90.5 0Z" fill="white" fill-opacity="0.1"/></svg>') center/cover;
    opacity: 0.8;
}

/* Seções */
.md-form-wrapper .section {
    background: rgba(39, 54, 74, 0.1);
    border-radius: 16px;
    padding: 35px;
}

.md-form-wrapper .section-no-bg {
    background: transparent;
    padding: 0;
}

.md-form-wrapper .section-header {
    padding: 28px 35px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.md-form-wrapper .section-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.md-form-wrapper .section-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--md-primary-dark);
    margin: 0;
    margin-bottom: 30px;
}

.md-form-wrapper .profile-link-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.md-form-wrapper .profile-link-label {
    font-size: 20px;
    font-weight: 600;
    color: var(--md-primary-dark);
}

.md-form-wrapper .profile-link {
    font-size: 20px;
    font-weight: 500;
    color: var(--md-primary-blue);
    text-decoration: none;
}

/* Header Save Section */
.md-form-wrapper .header-save-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0;
    margin-top: 0;
    gap: 300px;
}

.md-form-wrapper .save-description {
    font-size: 20px;
    font-weight: 500;
    color: var(--md-primary-dark);
    max-width: 100%;
    flex: 1;
    margin: 0;
}

/* Botões */
.md-form-wrapper .btn-primary {
    background-color: var(--md-primary-dark);
    color: var(--md-white);
    border: none;
    border-radius: 4px;
    padding: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.md-form-wrapper .btn-primary:hover {
    opacity: 0.9;
}

.md-form-wrapper .btn-save {
    width: auto;
    min-width: 200px;
    height: 55px;
    flex-shrink: 0;
}

.md-form-wrapper .btn-upload {
    width: auto;
    min-width: 160px;
    height: 56px;
    align-self: center;
    margin-top: -100px;
    z-index: 1;
}

.md-form-wrapper .icon {
    font-size: 16px;
}

/* Formulário */
.md-form-wrapper .form-grid {
    display: flex;
    gap: 44px;
}

.md-form-wrapper .form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 40px;
}

.md-form-wrapper .section-3 .form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 20px clamp(20px, 3vw, 35px);
    align-items: start;
}

.md-form-wrapper .section-3 .form-group:first-child {
    grid-column: 1;
    grid-row: 1;
}

.md-form-wrapper .section-3 .form-group:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
}

.md-form-wrapper .section-3 .form-group.full-width {
    grid-column: 1;
    grid-row: 2;
}

.md-form-wrapper .section-3 .form-group:last-child {
    grid-column: 2;
    grid-row: 2;
}

.md-form-wrapper .section-5 .form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(15px, 2vw, 25px);
}

.md-form-wrapper .section-5 .form-grid-2 .form-group {
    width: 100%;
}

.md-form-wrapper .section-5 .form-grid-2 .form-group .form-input {
    width: 100%;
}

.md-form-wrapper .section-4-grid {
    display: flex;
    gap: clamp(20px, 3vw, 35px);
}

.md-form-wrapper .section-4-left {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 0 0 auto;
    min-width: min(100%, 400px);
    max-width: 400px;
}

.md-form-wrapper .section-4-left .form-group:first-child .radio-group {
    width: 100%;
}

.md-form-wrapper .section-4-left .form-group:nth-child(2) .radio-group {
    width: 100%;
}

.md-form-wrapper .section-4-left .form-group:last-child .radio-group {
    width: 100%;
}

.md-form-wrapper .section-4-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.md-form-wrapper .form-group-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.md-form-wrapper .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.md-form-wrapper .form-label {
    font-size: 20px;
    font-weight: 500;
    color: var(--md-primary-dark);
}

.md-form-wrapper .form-hint {
    font-size: 16px;
    font-weight: 600;
    color: var(--md-text-hint);
    margin: 0;
}

.md-form-wrapper .form-input,
.md-form-wrapper .form-textarea {
    width: 100%;
    height: 68px;
    padding: 20px;
    border: 1px solid var(--md-border-color);
    border-radius: 4px;
    background-color: var(--md-white);
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 500;
    color: var(--md-black);
}

.md-form-wrapper .form-group-group .form-input:first-child {
    width: 100%;
    max-width: 461px;
}

.md-form-wrapper .form-group-group .form-row .form-group:first-child {
    flex: 1;
    min-width: 0;
}

.md-form-wrapper .form-group-group .form-row .form-group:first-child .form-input {
    width: 100%;
}

.md-form-wrapper .form-group-group .form-row .form-group:last-child {
    flex: 0 0 auto;
    min-width: 120px;
}

.md-form-wrapper .form-group-group .form-row .form-group:last-child .form-input {
    width: 100%;
}

.md-form-wrapper .form-group-group .form-textarea {
    width: 100%;
    /* max-width: 790px; */
}

.md-form-wrapper .form-textarea {
    height: auto;
    min-height: 158px;
}

.md-form-wrapper .form-input::placeholder,
.md-form-wrapper .form-textarea::placeholder {
    color: var(--md-text-secondary);
    opacity: 1;
}

.md-form-wrapper .form-textarea {
    resize: vertical;
}

.md-form-wrapper .form-textarea.large {
    min-height: 158px;
}

/* Foto de perfil */
.md-form-wrapper .profile-photo-group {
    width: 100%;
    max-width: 330px;
    flex-shrink: 0;
}

.md-form-wrapper .photo-upload-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.md-form-wrapper .photo-placeholder {
    width: 100%;
    height: 329px;
    background-color: var(--md-white);
    border: 1px solid var(--md-border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s;
}

.md-form-wrapper .photo-placeholder:hover {
    border-color: var(--md-primary-dark);
}

.md-form-wrapper .photo-placeholder.has-image {
    cursor: pointer;
}

.md-form-wrapper .photo-placeholder #photo-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    display: none;
}

.md-form-wrapper .photo-placeholder.has-image #photo-image {
    display: block;
}

.md-form-wrapper .photo-placeholder.has-image #photo-info {
    display: none;
}

.md-form-wrapper .photo-info {
    text-align: center;
    font-size: 20px;
    font-weight: 500;
    color: var(--md-text-hint);
    position: relative;
    z-index: 1;
}

.md-form-wrapper .photo-info p {
    margin: 0;
}

.md-form-wrapper .photo-info p:first-child {
    margin-bottom: 4px;
}

/* Form Row */
.md-form-wrapper .form-row {
    display: flex;
    gap: 12px;
}

.md-form-wrapper .form-row .form-group:first-child {
    flex: 1;
    min-width: 0;
}

.md-form-wrapper .form-row .form-group:last-child {
    flex: 0 0 auto;
    min-width: 120px;
}

/* Select */
.md-form-wrapper .select-wrapper {
    position: relative;
}

.md-form-wrapper .select-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    padding-right: 50px;
}

.md-form-wrapper .select-arrow {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--md-primary-dark);
    font-size: 20px;
    pointer-events: none;
    z-index: 1;
}

/* Radio Group */
.md-form-wrapper .radio-group {
    display: flex;
    border-radius: 4px;
    overflow: hidden;
    height: 68px;
}

.md-form-wrapper .radio-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    border: 1px solid var(--md-primary-dark);
}

.md-form-wrapper .radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.md-form-wrapper .radio-option span {
    font-size: 20px;
    font-weight: 500;
    color: var(--md-primary-dark);
    pointer-events: none;
}

.md-form-wrapper .radio-option input[type="radio"]:checked + span {
    font-weight: 600;
}

.md-form-wrapper .radio-option input[type="radio"]:checked {
    background-color: var(--md-primary-blue);
}

.md-form-wrapper .radio-option:has(input[type="radio"]:checked) {
    background-color: rgba(0, 0, 255, 0.1);
}

.md-form-wrapper .section-4-left .form-group:first-child {
    margin-bottom: 0;
}

/* Input com prefixo */
.md-form-wrapper .input-with-prefix {
    position: relative;
}

.md-form-wrapper .input-prefix {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    font-weight: 500;
    color: var(--md-primary-dark);
    pointer-events: none;
}

.md-form-wrapper .input-with-prefix .form-input {
    padding-left: 50px;
}

.md-form-wrapper .input-with-prefix .input-prefix {
    z-index: 1;
}

label {
    margin-bottom: 0px !important;
}

/* Tags */
.md-form-wrapper .input-with-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 0px 10px;
    border: 1px solid var(--md-border-color);
    border-radius: 4px;
    background-color: var(--md-white);
    min-height: 68px;
}

.md-form-wrapper .input-with-tags .form-input {
    border: none;
    padding: 12px 8px;
    flex: 1;
    min-width: 120px;
    background: transparent;
}

.md-form-wrapper .input-with-tags .form-input:focus {
    outline: none;
}

/* Autocomplete */
.md-form-wrapper .autocomplete-container {
    position: relative;
}

.md-form-wrapper .autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--md-white);
    border: 1px solid var(--md-border-color);
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    margin-top: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.md-form-wrapper .autocomplete-list.active {
    display: block;
}

.md-form-wrapper .autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: var(--md-primary-dark);
    border-bottom: 1px solid var(--md-border-color);
    transition: background-color 0.2s;
}

.md-form-wrapper .autocomplete-item:last-child {
    border-bottom: none;
}

.md-form-wrapper .autocomplete-item:hover,
.md-form-wrapper .autocomplete-item.selected {
    background-color: var(--md-bg-light-blue);
}

.md-form-wrapper .autocomplete-item.highlight {
    font-weight: 600;
}

.md-form-wrapper .tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--md-primary-blue);
    color: var(--md-white);
    padding: 4px 12px;
    border-radius: 24px;
    font-size: 20px;
    font-weight: 500;
    height: 42px;
    white-space: nowrap;
}

.md-form-wrapper .tag-remove {
    background: none;
    border: none;
    color: var(--md-white);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    margin: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.md-form-wrapper .tag-remove:hover {
    opacity: 0.8;
}

/* Formação */
.md-form-wrapper .formacao-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 30px;
}

.md-form-wrapper .formacao-group:last-child {
    margin-bottom: 0;
}

.md-form-wrapper .formacao-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.md-form-wrapper .formacao-row .form-input {
    flex: 1;
}

.md-form-wrapper .formacao-row .form-input:first-child {
    flex: 1;
    min-width: 200px;
}

.md-form-wrapper .form-input-small {
    flex: 0 0 auto;
    min-width: 100px;
    max-width: 136px;
}

.md-form-wrapper .form-input-medium {
    flex: 1;
    min-width: 150px;
    max-width: 274px;
}

.md-form-wrapper .formacao-group {
    margin-bottom: 50px;
}

.md-form-wrapper .formacao-group:last-of-type {
    margin-bottom: 0;
}

/* Seção 7 */
.md-form-wrapper .section-7 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 26px 35px;
}

.md-form-wrapper .section-7 .btn-save {
    width: auto;
    min-width: 200px;
    flex-shrink: 0;
}

/* Mensagens do formulário */
.md-form-wrapper .form-messages {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 4px;
    display: none;
    font-size: 16px;
    font-weight: 500;
}

.md-form-wrapper .form-messages.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.md-form-wrapper .form-messages.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Contador de caracteres */
.md-form-wrapper .form-group small {
    color: var(--md-text-hint);
    font-size: 14px;
    text-align: right;
    display: block;
    margin-top: 4px;
}

/* Ajustes específicos das seções */
.md-form-wrapper .section-1 {
    margin-top: 0;
}

.md-form-wrapper .section-2 {
    margin-top: 0;
}

.md-form-wrapper .section-4 {
    margin-top: 0;
}

.md-form-wrapper .section-2 .form-textarea {
    width: 100%;
    max-width: 100%;
}

/* Campos obrigatórios */
.md-form-wrapper .form-label[required]::after {
    content: " *";
    color: #ff4444;
}

/* Responsividade */
@media (max-width: 1200px) {
    .md-form-wrapper {
        padding: clamp(15px, 2vw, 20px);
    }

    .md-form-wrapper .md-form-container {
        max-width: 100%;
    }

    .md-form-wrapper .form-grid {
        flex-direction: column;
    }

    .md-form-wrapper .profile-photo-group {
        width: 100%;
        max-width: 330px;
    }

    .md-form-wrapper .form-grid-2 {
        grid-template-columns: 1fr;
    }

    .md-form-wrapper .section-3 .form-grid-2 {
        grid-template-columns: 1fr;
    }

    .md-form-wrapper .section-5 .form-grid-2 {
        grid-template-columns: 1fr;
    }

    .md-form-wrapper .section-4-grid {
        flex-direction: column;
    }

    .md-form-wrapper .section-4-left {
        max-width: 100%;
    }

    .md-form-wrapper .header-save-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .md-form-wrapper .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .md-form-wrapper .section-7 {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .md-form-wrapper .form-group-group .form-input:first-child {
        max-width: 100%;
    }

    .md-form-wrapper .form-group-group .form-textarea {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .md-form-wrapper {
        padding: 15px;
    }

    .md-form-wrapper .section {
        padding: clamp(20px, 3vw, 35px);
    }

    .md-form-wrapper .section-header {
        padding: clamp(20px, 3vw, 28px) clamp(20px, 3vw, 35px);
    }

    .md-form-wrapper .header,
    .md-form-wrapper .md-form-header {
        padding: 0 clamp(20px, 3vw, 35px);
        height: auto;
        min-height: 100px;
    }

    .md-form-wrapper .header-title,
    .md-form-wrapper .md-form-header-title {
        font-size: clamp(24px, 5vw, 36px);
    }

    .md-form-wrapper .formacao-row {
        flex-direction: column;
    }

    .md-form-wrapper .form-input-small,
    .md-form-wrapper .form-input-medium {
        flex: 1;
        max-width: 100%;
    }

    .md-form-wrapper .form-row {
        flex-direction: column;
    }

    .md-form-wrapper .form-row .form-group:first-child,
    .md-form-wrapper .form-row .form-group:last-child {
        flex: 1;
        width: 100%;
    }

    .md-form-wrapper .btn-save,
    .md-form-wrapper .btn-upload {
        width: 100%;
        min-width: auto;
    }

    .md-form-wrapper .section-title {
        font-size: clamp(20px, 4vw, 24px);
    }

    .md-form-wrapper .form-label {
        font-size: clamp(16px, 3vw, 20px);
    }

    .md-form-wrapper .form-input,
    .md-form-wrapper .form-textarea {
        font-size: clamp(16px, 3vw, 20px);
        padding: clamp(12px, 2vw, 20px);
    }
}

@media (max-width: 480px) {
    .md-form-wrapper {
        padding: 10px;
    }

    .md-form-wrapper .md-form-container {
        gap: clamp(20px, 4vw, 35px);
    }

    .md-form-wrapper .section {
        padding: 20px;
    }

    .md-form-wrapper .photo-placeholder {
        height: clamp(250px, 50vw, 329px);
    }
}

/* Estilos para o select de graduação */
.md-form-wrapper .formacao-row .select-wrapper {
    position: relative;
    flex: 1;
}

.md-form-wrapper .formacao-row .select-wrapper select {
    width: 100%;
    height: 68px;
    padding: 20px;
    border: 1px solid var(--md-border-color);
    border-radius: 4px;
    background-color: var(--md-white);
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 500;
    color: var(--md-black);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
}

.md-form-wrapper .formacao-row .select-wrapper .select-arrow {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--md-primary-dark);
    font-size: 20px;
    pointer-events: none;
    z-index: 1;
}

/* Responsividade para o select */
@media (max-width: 768px) {
    .md-form-wrapper .formacao-row {
        flex-direction: column;
    }
    
    .md-form-wrapper .formacao-row .select-wrapper {
        width: 100%;
    }
    
    .md-form-wrapper .formacao-row .form-input-small,
    .md-form-wrapper .formacao-row .form-input-medium {
        width: 100%;
        max-width: 100%;
    }
}