/**
 * DaheCMS Jiandan template - member login/register modal
 * Aligns with the Jiandan light blue-gray interface.
 */

/* ========== Overlay ========== */
.dahe-login-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(23, 43, 76, .42);
    backdrop-filter: blur(4px);
    z-index: 9998;
    animation: daheLoginFadeIn .2s ease;
}

.dahe-login-overlay.active {
    display: block;
}

/* ========== Modal Shell ========== */
.dahe-login-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    width: min(92vw, 430px);
    max-height: min(90vh, 760px);
    overflow: hidden;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(133, 153, 171, .22);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 46px rgba(23, 43, 76, .16);
    color: #333;
    text-align: left;
    z-index: 9999;
    animation: daheLoginSlideIn .22s ease;
}

.dahe-login-modal.active {
    display: flex;
    flex-direction: column;
}

/* ========== Header ========== */
.dahe-modal-header {
    position: relative;
    flex: 0 0 auto;
    padding: 24px 28px 18px;
    border-bottom: 1px solid #e3eaf4;
    background:
        linear-gradient(135deg, rgba(32, 125, 244, .08) 0%, rgba(126, 162, 215, .12) 100%),
        #fff;
    color: #172b4c;
}

.dahe-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #dce6e8;
    border-radius: 4px;
    background: #fff;
    color: #52677d;
    font-size: 22px;
    line-height: 1;
    box-shadow: none;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease, color .2s ease;
}

.dahe-modal-close:hover {
    border-color: #9bc4ee;
    background: #eef7ff;
    color: #207df4;
}

.dahe-modal-title {
    margin: 0;
    padding-right: 44px;
    color: #16243c;
    font-size: 24px;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: 0;
}

.dahe-modal-subtitle {
    margin: 6px 0 0;
    padding-right: 44px;
    color: #66758c;
    font-size: 14px;
    line-height: 1.7;
}

/* ========== Tabs ========== */
.dahe-modal-tabs {
    display: flex;
    gap: 24px;
    margin-top: 18px;
    padding: 0;
    border-bottom: 1px solid #dfe7f2;
    background: transparent;
}

.dahe-modal-tab {
    position: relative;
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 2px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #52677d;
    font-size: 14px;
    font-weight: 800;
    line-height: 38px;
    cursor: pointer;
    box-shadow: none;
    transition: color .2s ease;
}

.dahe-modal-tab::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    border-radius: 2px;
    background: transparent;
    transition: background .2s ease;
}

.dahe-modal-tab:hover {
    color: #207df4;
}

.dahe-modal-tab.active {
    color: #207df4;
}

.dahe-modal-tab.active::after {
    background: #207df4;
}

/* ========== Body ========== */
.dahe-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 24px 28px;
    overflow-y: auto;
    background: #fff;
}

.dahe-tab-content {
    display: none;
}

.dahe-tab-content.active {
    display: block;
    animation: daheLoginContentIn .18s ease;
}

/* ========== Form ========== */
.dahe-form-group {
    margin-bottom: 16px;
}

.dahe-form-label {
    display: block;
    margin-bottom: 7px;
    color: #39526f;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
}

.dahe-form-label .required {
    margin-left: 2px;
    color: #ff562f;
}

.dahe-input-wrapper {
    position: relative;
}

.dahe-input-icon {
    position: absolute;
    top: 50%;
    left: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    transform: translateY(-50%);
    color: #7e8da3;
    font-size: 14px;
    line-height: 1;
    pointer-events: none;
}

.dahe-form-input {
    width: 100%;
    min-height: 42px;
    padding: 0 13px 0 42px;
    border: 1px solid #dce6e8;
    border-radius: 4px;
    background: #fff;
    color: #172b4c;
    font-size: 14px;
    line-height: 42px;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.dahe-form-input:hover {
    border-color: #c9d8ea;
}

.dahe-form-input:focus {
    border-color: #9bc4ee;
    background: #fbfdff;
    box-shadow: 0 0 0 3px rgba(32, 125, 244, .1);
}

.dahe-form-input::placeholder {
    color: #9aa8b8;
}

/* Captcha */
.dahe-captcha-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dahe-captcha-input {
    flex: 1 1 auto;
    min-width: 0;
}

.dahe-captcha-image {
    flex: 0 0 104px;
    width: 104px;
    height: 42px;
    border: 1px solid #dce6e8;
    border-radius: 4px;
    background: #f5f8fc;
    object-fit: cover;
    cursor: pointer;
    transition: border-color .2s ease;
}

.dahe-captcha-image:hover {
    border-color: #9bc4ee;
}

/* ========== Checkbox and Links ========== */
.dahe-form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.dahe-checkbox-wrapper {
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

.dahe-checkbox {
    width: 15px;
    height: 15px;
    margin: 0 8px 0 0;
    accent-color: #207df4;
    cursor: pointer;
}

.dahe-checkbox-label {
    color: #66758c;
    font-size: 13px;
    line-height: 1.6;
    cursor: pointer;
    user-select: none;
}

.dahe-link {
    color: #207df4;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: color .2s ease;
}

.dahe-link:hover {
    color: #0052cc;
    text-decoration: none;
}

/* ========== Buttons ========== */
.dahe-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 42px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 800;
    line-height: 42px;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease, color .2s ease, box-shadow .2s ease;
}

.dahe-btn-primary {
    border-color: #b8d2f2;
    background: linear-gradient(135deg, #7ea2d7 0%, #5dadf3 100%);
    color: #fff;
    box-shadow: 0 8px 18px rgba(32, 125, 244, .16);
}

.dahe-btn-primary:hover {
    border-color: #9bc4ee;
    background: linear-gradient(135deg, #7199cf 0%, #4d9fed 100%);
    color: #fff;
}

.dahe-btn-primary:active {
    box-shadow: 0 4px 10px rgba(32, 125, 244, .12);
}

.dahe-btn:disabled {
    opacity: .65;
    cursor: not-allowed;
    box-shadow: none;
}

/* ========== Alerts ========== */
.dahe-alert {
    display: none;
    margin-bottom: 16px;
    padding: 11px 13px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.6;
    animation: daheLoginContentIn .18s ease;
}

.dahe-alert.show {
    display: block;
}

.dahe-alert-success {
    border-color: #bfe5cc;
    background: #effaf3;
    color: #1d6b39;
}

.dahe-alert-error {
    border-color: #f3c2bd;
    background: #fff3f1;
    color: #b33a2c;
}

.dahe-alert-info {
    border-color: #b8d2f2;
    background: #eef7ff;
    color: #1e5f9f;
}

/* ========== Footer ========== */
.dahe-modal-footer {
    flex: 0 0 auto;
    padding: 15px 28px 22px;
    border-top: 1px solid #e3eaf4;
    background: #fbfdff;
    text-align: center;
}

.dahe-footer-text {
    margin: 0;
    color: #66758c;
    font-size: 13px;
    line-height: 1.7;
}

.dahe-footer-text .dahe-link {
    font-weight: 800;
}

/* ========== Loading ========== */
.dahe-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid rgba(255, 255, 255, .75);
    border-top-color: transparent;
    border-radius: 50%;
    animation: daheLoginSpin .65s linear infinite;
}

/* ========== Animations ========== */
@keyframes daheLoginFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes daheLoginSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

@keyframes daheLoginContentIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes daheLoginSpin {
    to {
        transform: rotate(360deg);
    }
}

/* ========== Responsive ========== */
@media (max-width: 480px) {
    .dahe-login-modal {
        width: calc(100vw - 24px);
        max-height: calc(100vh - 24px);
    }

    .dahe-modal-header {
        padding: 20px 18px 16px;
    }

    .dahe-modal-body {
        padding: 20px 18px;
    }

    .dahe-modal-footer {
        padding: 14px 18px 18px;
    }

    .dahe-modal-title {
        font-size: 22px;
    }

    .dahe-form-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .dahe-form-input {
        font-size: 16px;
    }

    .dahe-captcha-row {
        align-items: stretch;
        flex-direction: column;
    }

    .dahe-captcha-image {
        width: 100%;
        flex-basis: 42px;
    }
}
