/**
 * Xila Auth Modal CSS
 * File Location: /wp-content/plugins/xila/modules/auth/auth-modal.css
 */

/* ── Overlay ──────────────── */
.xila-auth-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}
.xila-auth-overlay.is-open {
    display: flex;
}
body.xila-modal-open {
    overflow: hidden;
}

/* ── Backdrop ─────────────────── */
.xila-auth-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ── Modal Box ────────────────── */
.xila-auth-modal {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 20px;
    padding: 36px 32px 32px;
    width: 100%;
    max-width: 420px;
    margin: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
    animation: xilaModalIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes xilaModalIn {
    from { opacity: 0; transform: scale(0.94) translateY(12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Close Button ───────────── */
.xila-auth-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.xila-auth-close:hover {
    background: #e2e8f0;
    color: #1e293b;
}
.xila-auth-close svg { width: 16px; height: 16px; }

/* ── Tabs ───────────────── */
.xila-auth-tabs {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 28px;
}
.xila-auth-tab {
    flex: 1;
    padding: 9px;
    border: none;
    border-radius: 7px;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}
.xila-auth-tab.is-active {
    background: #fff;
    color: #1e293b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ── Panels ──────────────── */
.xila-auth-panel { display: none; }
.xila-auth-panel.is-active { display: block; }

.xila-auth-title {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 4px;
}
.xila-auth-subtitle {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 22px;
}

/* ── Error / Success ─────────────── */
.xila-auth-error {
    display: none;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
}
.xila-auth-error.is-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}
.xila-auth-error.is-success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #16a34a;
}

/* ── Fields ───────────────── */
.xila-auth-field {
    margin-bottom: 16px;
}
.xila-auth-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}
.xila-req { color: #ef4444; }

.xila-auth-field input[type="text"],
.xila-auth-field input[type="email"],
.xila-auth-field input[type="password"] {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    color: #1e293b;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    background: #fff;
}
.xila-auth-field input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.xila-auth-input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

/* ── Password wrap ──────────── */
.xila-auth-pw-wrap {
    position: relative;
}
.xila-auth-pw-wrap input {
    padding-right: 44px;
}
.xila-pw-toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}
.xila-pw-toggle:hover { color: #475569; }
.xila-pw-toggle svg { width: 16px; height: 16px; }

/* ── Remember ───────────── */
.xila-auth-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #475569;
    margin-bottom: 20px;
    cursor: pointer;
}
.xila-auth-remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #6366f1;
    cursor: pointer;
}

/* ── Submit Button ──────────── */
.xila-auth-submit {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
    margin-bottom: 18px;
}
.xila-auth-submit:hover:not(:disabled) {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}
.xila-auth-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ── Spinner ───────────────── */
.xila-auth-spinner {
    display: none;
    width: 17px;
    height: 17px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: xilaSpin 0.65s linear infinite;
    flex-shrink: 0;
}
@keyframes xilaSpin { to { transform: rotate(360deg); } }

/* ── Switch link ────────────── */
.xila-auth-switch {
    text-align: center;
    font-size: 13px;
    color: #64748b;
    margin: 0;
}
.xila-auth-switch-btn {
    background: none;
    border: none;
    color: #6366f1;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
}
.xila-auth-switch-btn:hover { text-decoration: underline; }

/* ── Header Login Button ──────────────── */
.xila-login-btn {
    padding: 8px 18px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.xila-login-btn:hover {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* ── User Menu (logged in) ─────────────── */
.xila-user-menu {
    position: relative;
    display: inline-block;
}
.xila-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px 5px;
    background: #f1f5f9;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    transition: background 0.15s;
}
.xila-user-btn:hover { background: #e2e8f0; }
.xila-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.xila-user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 160px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
    padding: 6px 0;
    z-index: 9999;
}
.xila-user-menu:hover .xila-user-dropdown,
.xila-user-menu.is-open .xila-user-dropdown {
    display: block;
}
.xila-user-dropdown a {
    display: block;
    padding: 9px 16px;
    font-size: 13px;
    color: #374151;
    text-decoration: none;
    transition: background 0.12s;
}
.xila-user-dropdown a:hover { background: #f8fafc; }
.xila-logout-link { color: #ef4444 !important; }

/* ── Mobile ────────────────── */
@media (max-width: 480px) {
    .xila-auth-modal {
        padding: 28px 20px 24px;
        border-radius: 16px;
        margin: 12px;
    }
    .xila-auth-title { font-size: 20px; }
}