/* ================= AUTH & RBAC STYLES (auth.css) ================= */

/* ---- Role Badge ---- */
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border: 1px solid;
}

/* ---- User Menu in Header ---- */
#auth-user-menu {
    display: none;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
    z-index: 2500;
}

.auth-avatar-wrapper {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(208, 189, 149, 0.4);
    flex-shrink: 0;
    transition: border-color 0.2s;
}

.auth-avatar-wrapper:hover {
    border-color: rgba(208, 189, 149, 0.9);
}

.auth-avatar-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.auth-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: rgba(15, 18, 24, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    min-width: 200px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.2s, transform 0.2s;
    z-index: 9999;
}

.auth-dropdown.open {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

.auth-dropdown-header {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-dropdown-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-dropdown-email {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}

.auth-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.auth-dropdown-item.danger {
    color: #ef4444;
}

.auth-dropdown-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.auth-dropdown-item .material-symbols-outlined {
    font-size: 18px;
}

/* ---- Login Button (header) ---- */
#auth-login-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(208, 189, 149, 0.1);
    border: 1px solid rgba(208, 189, 149, 0.3);
    color: #d0bd95;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    position: relative;
    z-index: 2500;
}

#auth-login-btn:hover {
    background: rgba(208, 189, 149, 0.2);
    border-color: rgba(208, 189, 149, 0.6);
    color: #fff;
}

/* ---- Auth Page Wrapper ---- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: rgba(15, 18, 24, 0.75);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 10;
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo-text {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: #fff;
}

.auth-logo-text .accent {
    color: #d0bd95;
}

.auth-title {
    font-size: 26px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
    text-align: center;
}

.auth-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    margin-bottom: 28px;
}

/* ---- Form Elements ---- */
.auth-form-group {
    margin-bottom: 18px;
}

.auth-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.auth-input-wrapper {
    position: relative;
}

.auth-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.3);
    font-size: 18px;
    pointer-events: none;
}

.auth-input {
    width: 100%;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff;
    font-size: 14px;
    padding: 12px 14px 12px 44px;
    transition: border-color 0.2s, background 0.2s;
    outline: none;
    font-family: inherit;
}

.auth-input:focus {
    border-color: rgba(208, 189, 149, 0.6);
    background: rgba(208, 189, 149, 0.05);
}

.auth-input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.auth-input.invalid {
    border-color: rgba(239, 68, 68, 0.6);
}

.auth-error-text {
    font-size: 12px;
    color: #ef4444;
    margin-top: 5px;
    display: none;
}

.auth-error-text.show {
    display: block;
}

/* ---- Password Toggle ---- */
.auth-pw-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
}

.auth-pw-toggle:hover {
    color: rgba(255, 255, 255, 0.7);
}

/* ---- Buttons ---- */
.btn-auth-primary {
    width: 100%;
    padding: 14px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 700;
    background: linear-gradient(135deg, #d0bd95, #b8a070);
    color: #0f1218;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
}

.btn-auth-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-auth-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-auth-google {
    width: 100%;
    padding: 12px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.07);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
}

.btn-auth-google:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-auth-google img {
    width: 18px;
    height: 18px;
}

/* ---- Divider ---- */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: rgba(255, 255, 255, 0.25);
    font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}

/* ---- Auth Footer Links ---- */
.auth-footer-link {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
}

.auth-footer-link a {
    color: #d0bd95;
    font-weight: 600;
    text-decoration: none;
}

.auth-footer-link a:hover {
    text-decoration: underline;
}

/* ---- Forgot Password ---- */
.auth-forgot-link {
    text-align: right;
    margin-top: -10px;
    margin-bottom: 16px;
}

.auth-forgot-link a {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
}

.auth-forgot-link a:hover {
    color: #d0bd95;
}

/* ---- Toast Message ---- */
.auth-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(15, 18, 24, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    padding: 12px 24px;
    font-size: 13px;
    color: #fff;
    z-index: 99999;
    transition: transform 0.3s, opacity 0.3s;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
}

.auth-toast.success {
    border-color: rgba(16, 185, 129, 0.4);
    color: #10b981;
}

.auth-toast.error {
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.auth-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---- Upgrade Modal ---- */
.upgrade-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.25s;
}

.upgrade-modal-overlay.active {
    opacity: 1;
}

.upgrade-modal-card {
    background: rgba(15, 18, 24, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 40px 36px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    position: relative;
    transform: translateY(20px);
    transition: transform 0.25s;
}

.upgrade-modal-overlay.active .upgrade-modal-card {
    transform: translateY(0);
}

.upgrade-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    padding: 4px;
    display: flex;
}

.upgrade-modal-close:hover {
    color: #fff;
}

.upgrade-icon {
    margin-bottom: 16px;
}

.upgrade-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
}

.upgrade-desc {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.6;
    margin-bottom: 24px;
}

.upgrade-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-upgrade {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s;
}

.btn-upgrade:hover {
    opacity: 0.85;
}

.btn-upgrade.btn-primary {
    background: linear-gradient(135deg, #d0bd95, #b8a070);
    color: #0f1218;
}

.btn-upgrade.btn-secondary {
    background: rgba(255, 255, 255, 0.07);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.6);
}

/* ---- Tab Lock Styles ---- */
.tab-locked {
    position: relative;
    opacity: 0.55;
}

.tab-lock-icon {
    font-size: 12px !important;
    position: absolute;
    top: 2px;
    right: 2px;
    color: rgba(255, 255, 255, 0.5);
}

.role-locked {
    pointer-events: none;
    opacity: 0.4;
    filter: blur(1px);
    user-select: none;
}

/* ---- Loading Spinner ---- */
.auth-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.2);
    border-top-color: #0f1218;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .auth-card {
        padding: 28px 20px;
    }

    .auth-title {
        font-size: 22px;
    }
}
