/* ============================================================
   Yellow Hello Companion — Auth Modal Styles
   Inherits CSS variables from EduzPlus theme (:root)
   ============================================================ */

/* ── Overlay ──────────────────────────────────────────────── */
.yhc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.yhc-overlay.yhc-active {
    opacity: 1;
    visibility: visible;
}

/* ── Modal Card ───────────────────────────────────────────── */
.yhc-modal {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.18);
    width: 100%;
    max-width: 420px;
    position: relative;
    transform: translateY(16px) scale(0.98);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    opacity: 0;
    overflow: hidden;
    max-height: 90vh;
    overflow-y: auto;
}
.yhc-overlay.yhc-active .yhc-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Top accent bar */
.yhc-modal-accent {
    height: 4px;
    background: var(--eduzplus-primary, #0056b3);
    border-radius: 20px 20px 0 0;
}

/* ── Modal Brand / Logo area ──────────────────────────────── */
.yhc-modal-brand {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.yhc-modal-logo {
    max-height: 40px;
    max-width: 140px;
    width: auto;
    display: block;
    object-fit: contain;
}
.yhc-modal-site-name {
    font-size: 18px;
    font-weight: 800;
    color: var(--eduzplus-primary, #0056b3);
    letter-spacing: -0.3px;
    line-height: 1;
    margin-bottom: 4px;
}

/* ── Modal Header ─────────────────────────────────────────── */
.yhc-modal-header {
    padding: 28px 28px 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.yhc-modal-logo {
    max-height: 36px;
    width: auto;
    display: block;
}
.yhc-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin: 0;
    line-height: 1.3;
}
.yhc-modal-subtitle {
    font-size: 13px;
    color: #9ca3af;
    margin: 4px 0 0;
}
.yhc-close-btn {
    flex-shrink: 0;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: background 0.2s, color 0.2s;
    font-size: 18px;
    line-height: 1;
    padding: 0;
}
.yhc-close-btn:hover {
    background: #e5e7eb;
    color: #111827;
}

/* ── Tabs ─────────────────────────────────────────────────── */
.yhc-tabs {
    display: flex;
    margin: 20px 28px 0;
    background: #f9fafb;
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}
.yhc-tab-btn {
    flex: 1;
    padding: 9px;
    background: none;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.yhc-tab-btn.yhc-active {
    background: #ffffff;
    color: var(--eduzplus-primary, #0056b3);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.yhc-tab-btn:not(.yhc-active):hover {
    color: #374151;
}

/* ── Form Body ────────────────────────────────────────────── */
.yhc-modal-body {
    padding: 24px 28px 28px;
}

.yhc-panel {
    display: none;
    opacity: 0;
}
.yhc-panel.yhc-active {
    display: block;
    animation: yhcPanelIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Panel enter: fade + rise up */
@keyframes yhcPanelIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
/* Panel exit: fade + float up */
@keyframes yhcPanelOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-8px); }
}

/* Alt section transitions (horizontal slide) */
.yhc-alt-section[hidden] { display: none; }

@keyframes yhcSectionInRight {
    from { opacity: 0; transform: translateX(28px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes yhcSectionInLeft {
    from { opacity: 0; transform: translateX(-28px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes yhcSectionOutLeft {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(-28px); }
}
@keyframes yhcSectionOutRight {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(28px); }
}

/* Fields */
.yhc-field {
    margin-bottom: 14px;
}
.yhc-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 5px;
}
.yhc-input {
    width: 100%;
    padding: 11px 14px;
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    color: #111827;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    font-family: inherit;
}
.yhc-input:focus {
    border-color: var(--eduzplus-primary, #0056b3);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.12);
    background: #ffffff;
}
.yhc-input.yhc-error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Password wrapper */
.yhc-password-wrap {
    position: relative;
}
.yhc-password-wrap .yhc-input {
    padding-right: 42px;
}
.yhc-toggle-pw {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    padding: 0;
    display: flex;
    align-items: center;
}
.yhc-toggle-pw:hover { color: #374151; }
.yhc-toggle-pw svg { width: 18px; height: 18px; }

/* Forgot password link */
.yhc-forgot-row {
    text-align: right;
    margin-top: 5px;
}
.yhc-forgot-link {
    font-size: 12px;
    color: var(--eduzplus-primary, #0056b3);
    text-decoration: none;
    font-weight: 500;
    opacity: 0.8;
    transition: opacity 0.2s;
}
.yhc-forgot-link:hover { opacity: 1; text-decoration: underline; }

/* Label hint */
.yhc-label-hint {
    font-weight: 400;
    color: #9ca3af;
}

/* Back link */
.yhc-back-link {
    color: #6b7280;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.2s;
}
.yhc-back-link:hover { color: var(--eduzplus-primary, #0056b3); }

/* Alt sections (forgot / reset) */

/* Submit button */
.yhc-submit-btn {
    width: 100%;
    padding: 13px;
    background: var(--eduzplus-primary, #0056b3);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: opacity 0.2s, transform 0.15s;
    font-family: inherit;
    letter-spacing: 0.01em;
}
.yhc-submit-btn:hover { opacity: 0.92; transform: translateY(-1px); }
.yhc-submit-btn:active { transform: translateY(0); }
.yhc-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.yhc-submit-btn.is-loading {
    opacity: 0.8;
    cursor: not-allowed;
}
.yhc-submit-btn.is-loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: yhcSpin 0.7s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}
@keyframes yhcSpin { to { transform: rotate(360deg); } }

/* Messages */
.yhc-msg {
    display: none;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 14px;
    line-height: 1.5;
}
.yhc-msg.yhc-success {
    display: block;
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}
.yhc-msg.yhc-error {
    display: block;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Footer text */
.yhc-form-footer {
    text-align: center;
    font-size: 12px;
    color: #9ca3af;
    margin-top: 14px;
}
.yhc-form-footer a {
    color: var(--eduzplus-primary, #0056b3);
    text-decoration: none;
    font-weight: 500;
}

/* ── Navbar Auth Button ───────────────────────────────────── */
.yhc-open-modal {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    padding: 9px 18px;
}

/* ── User Pill (logged in) ────────────────────────────────── */
.yhc-user-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.05);
    border: 1.5px solid rgba(0, 0, 0, 0.1);
    border-radius: 50px;
    padding: 5px 14px 5px 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--menu-text-color, #333);
    transition: background 0.2s, border-color 0.2s;
    user-select: none;
}
.yhc-user-pill:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.2);
}
.yhc-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--eduzplus-primary, #0056b3);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}
.yhc-user-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.yhc-chevron {
    width: 12px;
    height: 8px;
    transition: transform 0.25s ease;
    color: #6b7280;
}
.yhc-user-pill.open .yhc-chevron { transform: rotate(180deg); }

/* Dropdown */
.yhc-user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    min-width: 160px;
    padding: 6px;
    z-index: 9999;
    animation: yhcFadeDown 0.2s ease forwards;
}
@keyframes yhcFadeDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.yhc-user-pill.open .yhc-user-dropdown { display: block; }
.yhc-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    transition: background 0.15s;
    white-space: nowrap;
}
.yhc-dropdown-item:hover { background: #f3f4f6; color: #111827; }
.yhc-dropdown-item svg { width: 16px; height: 16px; color: #9ca3af; }
.yhc-dropdown-item.yhc-logout { color: #ef4444; }
.yhc-dropdown-item.yhc-logout svg { color: #ef4444; }
.yhc-dropdown-item.yhc-logout:hover { background: #fef2f2; }

/* ── Toast ────────────────────────────────────────────────── */
.yhc-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: #111827;
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.yhc-toast.yhc-success { background: #065f46; }
.yhc-toast.yhc-error   { background: #991b1b; }
.yhc-toast.yhc-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 480px) {
    .yhc-modal { border-radius: 16px; }
    .yhc-modal-body { padding: 20px 20px 24px; }
    .yhc-modal-header { padding: 22px 20px 0; }
    .yhc-tabs { margin: 16px 20px 0; }
    .yhc-user-name { display: none; }
}
