:root {
    --mdw-primary: #213A8F;
    --mdw-secondary: #90BF21;
}

.mdw-form-wrap {
    max-width: 860px;
    margin: 30px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.mdw-form-wrap .mdw-section {
    background: #fff;
    border: 1px solid #e0e4f0;
    border-radius: 12px;
    padding: 32px 30px 28px;
    margin-bottom: 24px;
    box-shadow: 0 2px 12px rgba(33,58,143,0.06);
}

.mdw-form-wrap .mdw-section h3 {
    margin: 0 0 24px 0;
    color: var(--mdw-primary);
    font-size: 20px;
    font-weight: 700;
    padding: 0 0 14px 0;
    border-bottom: 3px solid var(--mdw-secondary);
}

.mdw-form-wrap .mdw-row {
    display: flex;
    gap: 20px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.mdw-form-wrap .mdw-row:last-child {
    margin-bottom: 0;
}

.mdw-form-wrap .mdw-field {
    flex: 1;
    min-width: 220px;
}

.mdw-form-wrap .mdw-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: var(--mdw-primary);
}

.mdw-form-wrap .mdw-field label .req {
    color: #dc3545;
}

.mdw-form-wrap .mdw-field input,
.mdw-form-wrap .mdw-field select {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #d4d4d4;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    background: #fafafa;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.2s;
}

.mdw-form-wrap .mdw-field input:focus,
.mdw-form-wrap .mdw-field select:focus {
    border-color: var(--mdw-primary);
    background: #fff;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(33,58,143,0.12);
}

.mdw-form-wrap .mdw-check {
    background: #f5f8ee;
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 10px;
    border: 1px solid #e4edcc;
}

.mdw-form-wrap .mdw-check label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    line-height: 1.6;
    cursor: pointer;
    color: #333;
}

.mdw-form-wrap .mdw-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--mdw-secondary);
}

.mdw-form-wrap .mdw-check .popup-link {
    color: var(--mdw-primary);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
}

.mdw-form-wrap .mdw-check .popup-link:hover {
    color: #152a6b;
}

.mdw-form-wrap .mdw-submit {
    text-align: center;
    margin-top: 32px;
}

.mdw-form-wrap .mdw-submit button {
    background: linear-gradient(135deg, var(--mdw-primary) 0%, #152a6b 100%);
    color: #fff;
    border: none;
    padding: 14px 50px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(33,58,143,0.3);
    font-family: inherit;
    transition: all 0.25s;
}

.mdw-form-wrap .mdw-submit button:hover {
    background: linear-gradient(135deg, #152a6b 0%, #0f1f4f 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33,58,143,0.4);
}

/* Popups legales */
#mdw-popup-datos,
#mdw-popup-legal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.55);
    z-index: 999999;
    justify-content: center;
    align-items: center;
}

#mdw-popup-datos.active,
#mdw-popup-legal.active {
    display: flex;
}

#mdw-popup-datos .mdw-pop-body,
#mdw-popup-legal .mdw-pop-body {
    background: #fff;
    border-radius: 14px;
    max-width: 640px;
    width: 92%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 36px 32px 32px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

#mdw-popup-datos .mdw-pop-close,
#mdw-popup-legal .mdw-pop-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    background: none;
    border: none;
    padding: 4px 8px;
}

#mdw-popup-datos .mdw-pop-close:hover,
#mdw-popup-legal .mdw-pop-close:hover {
    color: #333;
}

#mdw-popup-datos h2,
#mdw-popup-legal h2 {
    margin: 0 0 16px 0;
    color: var(--mdw-primary);
    font-size: 22px;
    font-weight: 700;
}

#mdw-popup-datos p,
#mdw-popup-legal p {
    font-size: 14px;
    line-height: 1.7;
    color: #444;
    margin: 0 0 12px 0;
}

#mdw-popup-legal ol {
    margin: 0 0 0 20px;
    padding: 0;
    font-size: 14px;
    line-height: 1.7;
    color: #444;
}

#mdw-popup-legal ol li {
    margin-bottom: 10px;
}

/* Popup carta */
#mdw-popup-carta {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 999999;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#mdw-popup-carta.active {
    display: flex;
}

.mdw-carta-body {
    position: relative;
    background: #213A8F;
    padding: 16px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.mdw-carta-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    font-size: 28px;
    cursor: pointer;
    color: #fff;
    background: rgba(0,0,0,0.4);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.2s;
}

.mdw-carta-close:hover {
    background: rgba(0,0,0,0.7);
}

.mdw-carta-img {
    position: relative;
    width: 85vw;
    max-width: 430px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: top center;
    aspect-ratio: 1493 / 2560;
    border-radius: 12px;
    overflow: hidden;
}

.mdw-carta-campo {
    position: absolute;
    left: 8%;
}

.mdw-carta-recurso14 {
    top: 4%;
    width: 84%;
    text-align: center;
}

.mdw-carta-recurso14 img {
    display: inline-block;
    max-width: 80%;
    height: auto;
}

.mdw-carta-iconos-row {
    top: 18%;
    width: 84%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
}

.mdw-carta-iconos-row img {
    display: block;
    height: auto;
    max-height: 115px;
    width: auto;
}

.mdw-carta-iconos-row img:nth-child(1) { max-width: 52px; }
.mdw-carta-iconos-row img:nth-child(2) { max-width: 310px; max-height: 105px; }
.mdw-carta-iconos-row img:nth-child(3) { max-width: 56px; }

.mdw-carta-texto-row {
    top: 32%;
    width: 84%;
}

.mdw-carta-texto-row p {
    margin: 0;
    font-size: 17px;
    line-height: 1.5;
    color: #333;
    text-align: center;
    font-weight: 500;
    white-space: nowrap;
}

.mdw-carta-titulo {
    top: 46%;
    width: 74%;
}

.mdw-carta-foto {
    top: 67%;
    width: 78%;
}

.mdw-carta-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.mdw-carta-deco-top {
    display: block;
    width: auto;
    max-width: 260px;
    height: auto;
    position: relative;
}

.mdw-carta-titulo .mdw-carta-deco-top {
    top: 25px;
    margin: 0 -12px 8px auto;
}

.mdw-carta-foto .mdw-carta-deco-top {
    max-width: 180px;
    top: 12px;
    margin: 0 auto 8px 0;
}

.mdw-carta-deco-left {
    width: 56px;
    height: auto;
    flex-shrink: 0;
    margin-top: -6px;
    margin-left: -8px;
    align-self: flex-start;
}

.mdw-carta-deco-right {
    width: 60px;
    height: auto;
    flex-shrink: 0;
    margin-top: -4px;
    margin-right: -12px;
    align-self: flex-start;
}

.mdw-carta-input-wrap input[type="text"] {
    flex: 1;
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    color: #333;
    background: #e8e8e8;
    box-sizing: border-box;
    font-family: inherit;
    transition: background 0.2s, box-shadow 0.2s;
}

.mdw-carta-input-wrap input[type="text"]:focus {
    background: #ddd;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(33,58,143,0.1);
}

.mdw-carta-input-wrap input[type="text"]::placeholder {
    color: #999;
}

.mdw-carta-file {
    flex: 1;
    width: 100%;
}

.mdw-carta-file input[type="file"] {
    display: none;
}

.mdw-carta-label {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 14px;
    border: none;
    border-radius: 10px;
    background: #e8e8e8;
    cursor: pointer;
    transition: background 0.2s;
}

.mdw-carta-label:hover {
    background: #ddd;
}

.mdw-carta-file-icon {
    width: 22px;
    height: auto;
    margin-right: 8px;
    flex-shrink: 0;
}

.mdw-carta-bottom {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 6%;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mdw-carta-btn {
    background: #213A8F;
    color: #fff;
    border: none;
    padding: 10px 80px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 4px 14px rgba(33,58,143,0.35);
    transition: all 0.25s;
}

.mdw-carta-btn:hover {
    background: #152a6b;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33,58,143,0.45);
}

.mdw-carta-recurso25-bot {
    width: auto;
    max-width: 64px;
    height: auto;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .mdw-form-wrap {
        margin: 15px auto;
    }
    .mdw-form-wrap .mdw-section {
        padding: 20px 16px;
    }
    .mdw-form-wrap .mdw-field {
        min-width: 100%;
    }
    .mdw-form-wrap .mdw-submit button {
        width: 100%;
    }
    #mdw-popup-datos .mdw-pop-body,
    #mdw-popup-legal .mdw-pop-body {
        padding: 24px 18px 20px;
        max-height: 90vh;
        width: 95%;
    }
    .mdw-carta-body {
        padding: 8px;
        border-radius: 12px;
    }
    .mdw-carta-img {
        width: 92vw;
        max-width: 92vw;
    }
    .mdw-carta-campo {
        left: 11%;
    }
    .mdw-carta-recurso14 {
        top: 3%;
        width: 78%;
    }
    .mdw-carta-recurso14 img {
        max-width: 85%;
    }
    .mdw-carta-iconos-row {
        top: 15%;
        width: 78%;
    }
    .mdw-carta-iconos-row img {
        max-height: 80px;
    }
    .mdw-carta-iconos-row img:nth-child(1) { max-width: 36px; }
    .mdw-carta-iconos-row img:nth-child(2) { max-width: 210px; max-height: 72px; }
    .mdw-carta-iconos-row img:nth-child(3) { max-width: 40px; }
    .mdw-carta-texto-row {
        top: 32%;
        width: 78%;
    }
    .mdw-carta-texto-row p {
        font-size: 14px;
        white-space: normal;
    }
    .mdw-carta-titulo {
        top: 46%;
        width: 74%;
    }
    .mdw-carta-foto {
        top: 67%;
        width: 76%;
    }
    .mdw-carta-bottom {
        gap: 8px;
    }
    .mdw-carta-btn {
        padding: 10px 50px;
        font-size: 14px;
    }
    .mdw-carta-recurso25-bot {
        max-width: 44px;
    }
    .mdw-carta-close {
        top: 8px;
        right: 8px;
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
    .mdw-carta-deco-top {
        max-width: 200px;
    }
    .mdw-carta-deco-left {
        width: 44px;
        margin-left: -4px;
    }
    .mdw-carta-deco-right {
        width: 50px;
        margin-right: -6px;
    }
    .mdw-carta-titulo .mdw-carta-deco-top {
        top: 15px;
        margin: 0 0 6px auto;
    }
    .mdw-carta-foto .mdw-carta-deco-top {
        max-width: 140px;
        top: 8px;
        margin: 0 0 6px -4px;
    }
}
