/* ===== Registration (vertical, centered, simple card) ===== */
.pm-register-center-wrap {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 80vh;
    background: #f5f7fb;
    padding: 2em 0;
}

.pm-register-outer {
    max-width: 500px;
    width: 100%;
    margin: 2em auto;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 4px 32px rgba(40,48,60,.12);
    padding: 2em 1.5em 1.5em 1.5em;
    box-sizing: border-box;
}

.pm-register-form {
    display: flex;
    flex-direction: column;
    gap: 0;
    align-items: center;
    width: 100%;
}

.pm-register-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2em;
    width: 100%;
}

.pm-register-avatar-wrap > * {
    margin-bottom: 1em;
    width: 100%;
    text-align: center;
}

.pm-register-avatar-wrap > #avatar-preview {
    margin-bottom: 1em;
    width: 96px;
    height: 96px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.pm-register-avatar-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1em;
    width: 100%;
}

.pm-register-avatar-actions label {
    font-weight: 500;
    margin-bottom: .5em;
    color: #444;
    width: 100%;
    text-align: center;
    display: block;
}

.pm-register-avatar-actions input[type="file"] {
    display: inline-block;
    margin-bottom: .5em;
}

.pm-gallery-btn {
    margin: 1em auto 0 auto;
    display: block;
    padding: 0.5em 1.2em;
    background: #6c63ff;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1em;
    transition: background 0.2s;
}

.pm-gallery-note {
    display: block;
    margin-top: .5em;
    color: #888;
    text-align: center;
}

.pm-register-fields {
    width: 100%;
    max-width: 340px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: .5em;
}

.pm-register-fields .pm-profile-section-title {
    text-align: center;
    margin-bottom: 0.8em;
    margin-top: 0.8em;
    font-size: 1.2em;
}

.pm-register-fields label {
    font-weight: 500;
    margin-bottom: .2em;
    color: #354166;
    text-align: left;
}

.pm-register-fields input[type="text"],
.pm-register-fields input[type="email"],
.pm-register-fields input[type="password"] {
    width: 100%;
    padding: .8em .9em;
    margin-bottom: 1em;
    border: 1px solid #cad3dd;
    border-radius: 6px;
    background: #f8fafc;
    font-size: 1em;
    box-sizing: border-box;
    transition: border-color .2s;
}

.pm-register-fields input[type="text"]:focus,
.pm-register-fields input[type="email"]:focus,
.pm-register-fields input[type="password"]:focus {
    border-color: #6c63ff;
    outline: none;
    background: #fff;
}

.pm-register-fields input[type="submit"] {
    background: #6c63ff;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.7em 2em;
    font-size: 1em;
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.03em;
    box-shadow: 0 2px 8px 0 rgba(108,99,255,0.08);
    transition: background .2s;
    margin-top: 1em;
}

.pm-register-fields input[type="submit"]:hover {
    background: #574fcf;
}

/* ===== Profile (original styles, card with flex row) ===== */
.pm-profile-center-wrap {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 80vh;
    background: #f5f7fb;
    padding: 2em 0;
}
.pm-profile-outer {
    max-width: 900px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2em;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 4px 32px rgba(40,48,60,.12);
    margin: 2em auto;
    padding: 2em;
    box-sizing: border-box;
}
.pm-profile-top-card {
    display: flex;
    gap: 2em;
    align-items: flex-start;
    flex-wrap: wrap;
}
.pm-profile-avatar-col {
    flex: 0 0 350px;
    min-width: 350px;
    max-width: 390px;
    width: 350px;
    text-align: center;
    border-right: 1px solid #e7e7ea;
    padding: 2em 2em 2em 2em;
    background: #f8f8fb;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(40,48,60,.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    gap: 1em;
    margin-bottom: 1em;
}
.pm-profile-avatar-col:last-child {
    border-right: none;
}
.pm-profile-avatar-col img#avatar-preview {
    width: 120px;
    height: 120px;
    margin-bottom: 1em;
}
.pm-profile-avatar-actions {
    width: 100%;
    text-align: center;
    margin-bottom: 1em;
    margin-top: 1em;
}
.pm-profile-account-col {
    flex: 1 1 340px;
    padding-left: 2em;
    padding-right: 1em;
    min-width: 220px;
    max-width: 340px;
    padding-top: 1.5em;
    padding-bottom: 1.5em;
    box-sizing: border-box;
}
.pm-profile-account-col label {
    display: block;
    font-weight: 500;
    margin-bottom: .2em;
    color: #354166;
}
.pm-profile-account-col input[type="text"],
.pm-profile-account-col input[type="email"],
.pm-profile-account-col input[type="password"] {
    width: 100%;
    max-width: 320px;
    padding: .8em .9em;
    margin-bottom: 1em;
    border: 1px solid #cad3dd;
    border-radius: 6px;
    background: #f8fafc;
    font-size: 1em;
    box-sizing: border-box;
    transition: border-color .2s;
}
.pm-profile-account-col input[type="text"]:focus,
.pm-profile-account-col input[type="email"]:focus,
.pm-profile-account-col input[type="password"]:focus {
    border-color: #6c63ff;
    outline: none;
    background: #fff;
}
.pm-profile-bottom-row {
    display: flex;
    gap: 2em;
}
.pm-profile-bottom-frame {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 6px 24px 0 rgba(0,0,0,.10);
    padding: 2em;
    flex: 1 1 0;
    min-width: 280px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 1em;
}
.pm-profile-section-title {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: .6em;
    color: #2a3950;
    letter-spacing: 0.01em;
}
.pm-profile-bottom-frame label {
    font-weight: 500;
    display: block;
    margin-bottom: .2em;
    color: #354166;
}
.pm-profile-bottom-frame input[type="text"],
.pm-profile-bottom-frame input[type="url"],
.pm-profile-bottom-frame select,
.pm-profile-bottom-frame textarea {
    width: 100%;
    padding: 0.5em 0.7em;
    margin-bottom: 1em;
    border: 1px solid #cad3dd;
    border-radius: 6px;
    background: #f8fafc;
    font-size: 1em;
    box-sizing: border-box;
    transition: border-color .2s;
}
.pm-profile-bottom-frame input[type="text"]:focus,
.pm-profile-bottom-frame input[type="url"]:focus,
.pm-profile-bottom-frame select:focus,
.pm-profile-bottom-frame textarea:focus {
    border-color: #6c63ff;
    outline: none;
    background: #fff;
}
.pm-profile-bottom-frame textarea {
    resize: vertical;
    min-height: 80px;
}
.pm-profile-form input[type="submit"] {
    background: #6c63ff;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.7em 2em;
    font-size: 1em;
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.03em;
    box-shadow: 0 2px 8px 0 rgba(108,99,255,0.08);
    transition: background .2s;
    margin-top: 1em;
}
.pm-profile-form input[type="submit"]:hover {
    background: #574fcf;
}
.pm-profile-errors {
    background: #ffeaea;
    border: 1px solid #f5c7c7;
    color: #b20000;
    border-radius: 6px;
    margin-bottom: 1em;
    padding: 1em;
    word-break: break-word;
    white-space: normal;
    max-width: 100%;
    box-sizing: border-box;
}
.pm-profile-updated {
    background: #e7fae7;
    border: 1px solid #b2e6b2;
    color: #256029;
    border-radius: 6px;
    margin-bottom: 1em;
    padding: 1em;
    text-align: center;
    word-break: break-word;
    white-space: normal;
    max-width: 100%;
    box-sizing: border-box;
}

/* ===== Avatar Modal ===== */
#pm-avatar-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(40,48,60,0.25);
    z-index: 1000;
    overflow-y: auto;
    align-items: center;
    justify-content: center;
}
#pm-avatar-modal-overlay.open {
    display: flex;
}
#pm-avatar-modal {
    background: #fff;
    max-width: 420px;
    width: 96vw;
    min-width: 280px;
    max-height: 80vh;
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 14px;
    box-shadow: 0 6px 24px rgba(0,0,0,.14);
    padding: 2em;
    position: relative;
    display: flex;
    flex-direction: column;
}
#pm-close-gallery-modal {
    position: absolute;
    top: 1em;
    right: 1em;
    background: none;
    border: none;
    font-size: 2em;
    color: #444;
    cursor: pointer;
}
.pm-avatar-modal-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 20px;
    justify-items: center;
    align-items: center;
    margin-top: 1em;
    margin-bottom: 1em;
    overflow-x: hidden;
}
.pm-avatar-modal-option {
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}
.pm-avatar-modal-option img {
    width: 96px;
    height: 96px;
    border-radius: 10px;
    border: 2px solid #e7e7ea;
    box-shadow: 0 1px 6px rgba(0,0,0,0.09);
    transition: border-color 0.2s, box-shadow 0.2s;
    pointer-events: auto;
    box-sizing: border-box;
    display: block;
    margin: 0 auto;
}
.pm-avatar-modal-option img.selected,
.pm-avatar-modal-option img:focus {
    border-color: #6c63ff;
    box-shadow: 0 2px 16px rgba(108,99,255,0.13);
    outline: none;
}

/* Responsive: Modal fits viewport */
@media (max-width: 480px) {
    #pm-avatar-modal {
        padding: 1em;
        max-width: 98vw;
        min-width: unset;
    }
    .pm-avatar-modal-grid {
        gap: 10px;
    }
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .pm-profile-top-card, .pm-profile-bottom-row {
        flex-direction: column;
        gap: 1em;
    }
    .pm-profile-avatar-col,
    .pm-profile-account-col {
        border-right: none;
        padding-right: 0;
        margin-bottom: 1em;
        width: 98vw;
        min-width: 0;
        max-width: 100vw;
        padding: 1em;
    }
    #pm-avatar-modal {
        padding: 1em;
    }
    .pm-profile-outer {
        padding: 1em;
    }
}
@media (max-width: 600px) {
    .pm-register-outer {
        max-width: 98vw;
        padding: 1em .5em;
    }
    .pm-register-fields {
        max-width: 98vw;
    }
}