/* =============================================================
   iProphesy Auth Modal — auth-modal.css
   ============================================================= */

/* ── Overlay ── */
.ilms-auth-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .52);
    z-index: 99999;
    align-items: center;
    justify-content: center;
}
.ilms-auth-overlay.is-open {
    display: flex;
}

/* ── Card ── */
.ilms-auth-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 440px;
    margin: 16px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .22);
    animation: ilmsModalIn .22s ease;
}
@keyframes ilmsModalIn {
    from { opacity: 0; transform: translateY(12px) scale(.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);   }
}

/* ── Header ── */
.ilms-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px 4px;
}
.ilms-modal-title {
    font-size: 22px;
    font-weight: 700;
    color: #1d2d44;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans TC', sans-serif;
}
.ilms-modal-close {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    padding: 0 !important;
    border: 1.5px solid #d0d7e3 !important;
    background: transparent !important;
    border-radius: 50% !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box !important;
    line-height: 1 !important;
    color: #9ca3af;
    transition: border-color .15s, color .15s, background .15s;
    flex-shrink: 0;
    font-size: 0;
}
.ilms-modal-close:hover {
    border-color: #9ca3af !important;
    color: #555;
    background: #f5f6f8 !important;
}
.ilms-modal-close svg  { pointer-events: none; font-size: 0; }

/* ── Body ── */
.ilms-modal-body {
    padding: 20px 28px 22px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans TC', sans-serif;
}

/* ── Google OAuth button ── */
.ilms-oauth-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 11px 16px;
    border: 1.5px solid #dadce0;
    border-radius: 8px;
    background: #fff;
    font-size: 15px;
    font-weight: 500;
    color: #3c4043;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    font-family: inherit;
}
.ilms-oauth-google:hover {
    background: #f8f9fa;
    border-color: #b0b8c4;
}

/* ── Divider ── */
.ilms-modal-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0;
    font-size: 13px;
    color: #9ca3af;
}
.ilms-modal-divider::before,
.ilms-modal-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

/* ── Message (error / success) ── */
.ilms-modal-msg {
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 14px;
    display: none;
    line-height: 1.5;
}
.ilms-modal-msg.is-error {
    display: block;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
}
.ilms-modal-msg.is-success {
    display: block;
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
}

/* ── Input fields ── */
.ilms-modal-field {
    position: relative;
    margin-bottom: 12px;
}
.ilms-modal-input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #d0d7e3;
    border-radius: 8px;
    font-size: 14px;
    color: #1d2d44;
    background: #fff;
    box-sizing: border-box;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    font-family: inherit;
    -webkit-appearance: none;
}
.ilms-modal-input:focus {
    border-color: #d63a4a;
    box-shadow: 0 0 0 3px rgba(214, 58, 74, .1);
}
.ilms-modal-input::placeholder { color: #b0b8c4; }
.ilms-modal-input--pw { padding-right: 44px; }

/* ── Field icon prefix (flex row) ── */
.ilms-modal-field {
    display: flex !important;
    align-items: center;
    gap: 8px;
}
.ilms-field-icon {
    flex-shrink: 0;
    width: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b0b8c4;
    pointer-events: none;
    line-height: 0;
}
.ilms-input--has-icon {
    flex: 1;
    min-width: 0;
}

/* ── Eye toggle ── */
.ilms-eye-toggle {
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    display: flex;
    align-items: center;
    padding: 4px;
    transition: color .15s;
}
.ilms-eye-toggle:hover { color: #4b5563; }
.ilms-eye-toggle .eye-off { display: none; }

/* ── Password hint ── */
.ilms-pw-hint {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
    margin: -4px 0 12px;
}

/* ── Login bottom row ── */
.ilms-modal-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}
.ilms-modal-check-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    user-select: none;
}
.ilms-modal-check-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    flex-shrink: 0;
}

/* ── Privacy agree (register) ── */
.ilms-modal-agree {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: #555;
    margin-bottom: 18px;
    line-height: 1.5;
}
.ilms-modal-agree input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}
.ilms-modal-agree a {
    color: #d63a4a;
    text-decoration: none;
}
.ilms-modal-agree a:hover { text-decoration: underline; }

/* ── Submit button ── */
.ilms-modal-btn {
    background: #d63a4a;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 11px 28px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    letter-spacing: .02em;
    font-family: inherit;
    line-height: 1;
}
.ilms-modal-btn:hover { background: #b8303e; }
.ilms-modal-btn--full { width: 100%; }
.ilms-modal-btn.is-busy {
    opacity: .65;
    pointer-events: none;
}

/* ── Panel switching ── */
.ilms-modal-panel         { display: none; }
.ilms-modal-panel.is-active { display: block; }

/* ── Footer bar ── */
.ilms-modal-foot {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 13px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: #6b7280;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans TC', sans-serif;
}
.ilms-modal-foot a,
.ilms-modal-foot button {
    background: none;
    border: none;
    color: #d63a4a;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
    font-family: inherit;
}
.ilms-modal-foot a:hover,
.ilms-modal-foot button:hover { text-decoration: underline; }

/* ── Mobile: slide up from bottom ── */
@media (max-width: 480px) {
    .ilms-auth-overlay.is-open { align-items: flex-end; }
    .ilms-auth-modal {
        margin: 0;
        border-radius: 16px 16px 0 0;
        max-width: 100%;
    }
    @keyframes ilmsModalIn {
        from { opacity: 0; transform: translateY(24px); }
        to   { opacity: 1; transform: translateY(0);    }
    }
    .ilms-modal-head  { padding: 20px 20px 4px; }
    .ilms-modal-body  { padding: 16px 20px 18px; }
    .ilms-modal-foot  { padding: 13px 20px; }
}
