/* auth.css - Floating Login Button & Portal Panel */

/* ============================================
   BOTÃO FLUTUANTE DE ACESSO
   ============================================ */
#floating-theme-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--nav-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

#floating-theme-btn:hover {
    border-color: var(--brand-red);
    box-shadow: 0 0 20px var(--brand-red-glow);
    transform: scale(1.08);
    color: var(--text-main);
}

#theme-icon {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   PAINEL LATERAL DO PORTAL
   ============================================ */
#portal-panel {
    position: fixed;
    bottom: 92px;
    right: 30px;
    z-index: 9998;
    width: 320px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--header-scrolled-bg);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 20px;
    opacity: 0;
    transform: translateY(15px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

#portal-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.portal-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--glass-border);
}

.portal-panel-header h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Outfit', sans-serif;
}

#user-email-display {
    font-size: 0.75rem;
    color: #64748B;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}

.portal-logout-btn {
    background: none;
    border: none;
    color: #DD1A22;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
    font-family: 'Outfit', sans-serif;
    white-space: nowrap;
}

.portal-logout-btn:hover {
    background: rgba(221, 26, 34, 0.1);
}

#portal-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.portal-link-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-main);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    transition: all 0.25s ease;
}

.portal-link-item:hover {
    background: rgba(26, 92, 164, 0.15);
    border-color: rgba(26, 92, 164, 0.4);
    transform: translateX(3px);
}

.portal-link-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.portal-link-item strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
}

.portal-link-item small {
    display: block;
    font-size: 0.75rem;
    color: #64748B;
    margin-top: 2px;
}

/* ============================================
   MODAL DE LOGIN
   ============================================ */
#auth-login-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#auth-login-modal.open {
    opacity: 1;
    pointer-events: all;
}

.auth-modal-card {
    width: 100%;
    max-width: 420px;
    margin: 20px;
    background: var(--bg-body);
    border: 1px solid var(--glass-border);
    border-top: 2px solid #DD1A22;
    border-radius: 20px;
    padding: 40px;
    position: relative;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    transform: translateY(-10px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#auth-login-modal.open .auth-modal-card {
    transform: translateY(0) scale(1);
}

.auth-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #64748B;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 6px;
    transition: color 0.2s;
    line-height: 1;
}

.auth-modal-close:hover { color: #fff; }

.auth-modal-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-modal-logo .lock-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(26, 92, 164, 0.2), rgba(221, 26, 34, 0.2));
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin: 0 auto 15px;
}

.auth-modal-logo h2 {
    font-size: 1.4rem;
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
}

.auth-modal-logo p {
    font-size: 0.85rem;
    color: #64748B;
    margin-top: 5px;
}

.auth-form-group {
    margin-bottom: 18px;
}

.auth-form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.auth-form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s;
}

.auth-form-group input:focus {
    border-color: rgba(26, 92, 164, 0.6);
    box-shadow: 0 0 0 3px rgba(26, 92, 164, 0.15);
}

.auth-form-group input::placeholder { color: #475569; }

#auth-submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(90deg, #1A5CA4, #DD1A22);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
    margin-top: 8px;
}

#auth-submit-btn:hover { opacity: 0.9; transform: translateY(-1px); }
#auth-submit-btn:disabled { opacity: 0.6; transform: none; cursor: not-allowed; }

#auth-error {
    color: #f87171;
    font-size: 0.85rem;
    margin-top: 12px;
    text-align: center;
    min-height: 20px;
}

/* ============================================
   SEÇÃO ADMIN — BOTÃO NO PAINEL
   ============================================ */
.portal-admin-sep {
    height: 1px;
    background: var(--glass-border);
    margin: 12px 0 8px;
}

.portal-admin-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-main);
    cursor: pointer;
    font-size: 0.85rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    transition: all 0.2s;
    text-align: left;
}

.portal-admin-toggle:hover {
    background: rgba(26, 92, 164, 0.15);
    border-color: rgba(26, 92, 164, 0.4);
}

/* ============================================
   MODAL GERENCIAR USUÁRIOS
   ============================================ */
#padm-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 15000;
    background: rgba(2, 6, 23, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#padm-modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.padm-modal-card {
    width: 100%;
    max-width: 580px;
    max-height: 88vh;
    overflow-y: auto;
    background: var(--bg-body, #0f172a);
    border: 1px solid var(--glass-border, rgba(255,255,255,0.08));
    border-top: 3px solid #1A5CA4;
    border-radius: 22px;
    padding: 32px;
    box-shadow:
        0 32px 80px rgba(0,0,0,0.55),
        0 0 0 1px rgba(255,255,255,0.04) inset;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
    transform: translateY(16px) scale(0.97);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

#padm-modal-overlay.open .padm-modal-card {
    transform: translateY(0) scale(1);
}

.padm-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.padm-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: var(--text-main, #f1f5f9);
    margin: 0;
    background: linear-gradient(90deg, #93c5fd, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.padm-modal-close {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: #64748B;
    font-size: 1rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    line-height: 1;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.padm-modal-close:hover {
    color: #f1f5f9;
    background: rgba(248,113,113,0.15);
    border-color: rgba(248,113,113,0.3);
}

/* ── Nav tabs ──────────────────────────────── */
.padm-nav {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 4px;
}

.padm-nav-btn {
    flex: 1;
    padding: 10px 8px;
    border: none;
    background: transparent;
    color: #64748B;
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
    border-radius: 9px;
    transition: all 0.2s ease;
    position: relative;
}

.padm-nav-btn.active {
    background: linear-gradient(135deg, rgba(26, 92, 164, 0.3), rgba(96, 165, 250, 0.15));
    color: #93c5fd;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(26, 92, 164, 0.2);
}

.padm-nav-btn:not(.active):hover {
    background: rgba(255,255,255,0.05);
    color: #94a3b8;
}

/* ── User list rows ───────────────────────── */
#padm-users-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pu-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 14px;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.06);
    transition: all 0.25s ease;
    animation: padm-row-in 0.3s ease both;
}

.pu-row:hover {
    background: rgba(26, 92, 164, 0.08);
    border-color: rgba(26, 92, 164, 0.2);
    transform: translateX(2px);
}

@keyframes padm-row-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.pu-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(26, 92, 164, 0.35), rgba(147, 197, 253, 0.2));
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: #93c5fd;
    flex-shrink: 0;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.pu-email {
    flex: 1;
    min-width: 0;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-main, #e2e8f0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Inter', sans-serif;
}

.pu-role-sel {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: var(--text-main, #e2e8f0);
    font-size: 0.8rem;
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
    min-width: 100px;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748B' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.pu-role-sel:focus {
    border-color: rgba(26, 92, 164, 0.6);
    box-shadow: 0 0 0 3px rgba(26, 92, 164, 0.12);
}

.pu-role-sel:hover {
    border-color: rgba(255,255,255,0.2);
}

.pu-role-sel option {
    background: #1e293b;
    color: #e2e8f0;
    padding: 8px;
}

.pu-del {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    border: 1px solid transparent;
    background: transparent;
    color: #64748B;
    cursor: pointer;
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.pu-del:hover {
    color: #f87171;
    background: rgba(248,113,113,0.1);
    border-color: rgba(248,113,113,0.25);
}

/* ── States (loading, empty, error) ────────── */
.padm-state {
    text-align: center;
    padding: 40px 20px;
    color: #64748B;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    border-radius: 14px;
    background: rgba(255,255,255,0.02);
    border: 1px dashed rgba(255,255,255,0.07);
    line-height: 1.6;
}

.padm-state.padm-err {
    color: #f87171;
    border-color: rgba(248,113,113,0.2);
    background: rgba(248,113,113,0.04);
}

.padm-state.padm-err small {
    display: block;
    margin-top: 8px;
    color: #94a3b8;
    font-size: 0.82rem;
}

.padm-state.padm-err b {
    color: #fbbf24;
    font-family: 'Outfit', sans-serif;
}

/* ── Invite form ──────────────────────────── */
.padm-hint {
    font-size: 0.84rem;
    color: #64748B;
    margin: 0 0 20px;
    line-height: 1.6;
    padding: 12px 16px;
    background: rgba(26, 92, 164, 0.06);
    border: 1px solid rgba(26, 92, 164, 0.12);
    border-radius: 12px;
    border-left: 3px solid rgba(26, 92, 164, 0.4);
}

.padm-field-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.padm-input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: var(--text-main, #e2e8f0);
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: all 0.2s ease;
}

.padm-input:focus {
    border-color: rgba(26, 92, 164, 0.6);
    box-shadow: 0 0 0 3px rgba(26, 92, 164, 0.12);
    background: rgba(255,255,255,0.06);
}

.padm-input::placeholder {
    color: #475569;
}

.padm-select {
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: var(--text-main, #e2e8f0);
    font-size: 0.9rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    min-width: 120px;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748B' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 34px;
}

.padm-select:focus {
    border-color: rgba(26, 92, 164, 0.6);
    box-shadow: 0 0 0 3px rgba(26, 92, 164, 0.12);
}

.padm-select option {
    background: #1e293b;
    color: #e2e8f0;
}

.padm-btn-primary {
    width: 100%;
    padding: 13px 20px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #1A5CA4, #2563eb);
    color: #fff;
    font-size: 0.92rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.padm-btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(255,255,255,0.1));
    opacity: 0;
    transition: opacity 0.25s ease;
}

.padm-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(26, 92, 164, 0.35);
}

.padm-btn-primary:hover::before {
    opacity: 1;
}

.padm-btn-primary:active {
    transform: translateY(0);
}

/* ── Messages (success/error) ─────────────── */
.padm-msg {
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.86rem;
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
    animation: padm-msg-in 0.3s ease;
}

.padm-msg.ok {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.08);
    border: 1px solid rgba(74, 222, 128, 0.2);
}

.padm-msg.err {
    color: #f87171;
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

@keyframes padm-msg-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   RESPONSIVO MOBILE
   ============================================ */
@media (max-width: 768px) {
    #portal-panel { right: 15px; bottom: 90px; width: calc(100vw - 30px); }
    #floating-theme-btn { bottom: 20px; right: 20px; width: 48px; height: 48px; }

    .padm-modal-card {
        padding: 20px;
        border-radius: 18px;
        max-height: 92vh;
    }

    .padm-modal-title { font-size: 1.1rem; }

    .padm-field-row {
        flex-direction: column;
    }

    .pu-row {
        padding: 10px 12px;
        gap: 8px;
    }

    .pu-email {
        font-size: 0.8rem;
    }

    .pu-role-sel {
        min-width: 80px;
        font-size: 0.75rem;
        padding: 5px 24px 5px 8px;
    }

    .pu-avatar {
        width: 34px;
        height: 34px;
        font-size: 0.7rem;
    }
}
